From 95a1ae29b674f130708d86b1a377c5410c573569 Mon Sep 17 00:00:00 2001 From: glacambre Date: Sun, 1 Jul 2018 18:24:37 +0200 Subject: [PATCH] Make sure bind/unbind use the same binding format --- src/config.ts | 23 ++++++++++++----------- src/excmds.ts | 5 +++++ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/config.ts b/src/config.ts index a6829c18..391d53ee 100644 --- a/src/config.ts +++ b/src/config.ts @@ -33,6 +33,7 @@ function schlepp(settings) { let USERCONFIG = o({}) const DEFAULTS = o({ configversion: "0.0", + // When creating new maps, make sure to make the modifier uppercase (e.g. instead of ) otherwise some commands might not be able to find them (e.g. `bind `) nmaps: o({ "": "help", o: "fillcmdline open", @@ -44,8 +45,8 @@ const DEFAULTS = o({ "[[": "followpage prev", "[c": "urlincrement -1", "]c": "urlincrement 1", - "": "urlincrement -1", - "": "urlincrement 1", + "": "urlincrement -1", + "": "urlincrement 1", T: "current_url tabopen", yy: "clipboard yank", ys: "clipboard yankshort", @@ -55,26 +56,26 @@ const DEFAULTS = o({ p: "clipboard open", P: "clipboard tabopen", j: "scrollline 10", - "": "scrollline 10", + "": "scrollline 10", k: "scrollline -10", - "": "scrollline 10", + "": "scrollline 10", h: "scrollpx -50", l: "scrollpx 50", G: "scrollto 100", gg: "scrollto 0", - "": "scrollpage -0.5", - "": "scrollpage 0.5", + "": "scrollpage -0.5", + "": "scrollpage 0.5", // Disabled while our find mode is bad - /* "": "scrollpage -1", */ - // "": "scrollpage -1", + /* "": "scrollpage -1", */ + // "": "scrollpage -1", $: "scrollto 100 x", // "0": "scrollto 0 x", // will get interpreted as a count "^": "scrollto 0 x", - "": "buffer #", + "": "buffer #", H: "back", L: "forward", - "": "jumpprev", - "": "jumpnext", + "": "jumpprev", + "": "jumpnext", d: "tabclose", D: "composite tabprev; sleep 100; tabclose #", gx0: "tabclosealltoleft", diff --git a/src/excmds.ts b/src/excmds.ts index 64d64493..2ccddf5a 100644 --- a/src/excmds.ts +++ b/src/excmds.ts @@ -121,6 +121,7 @@ import { activeTab, firefoxVersionAtLeast, openInNewTab } from "./lib/webext" import * as CommandLineBackground from "./commandline_background" import * as rc from "./config_rc" import * as excmd_parser from "./parsers/exmode" +import { mapstrToKeyseq } from "./keyseq" //#background_helper import * as Native from "./native_background" @@ -2216,6 +2217,8 @@ export function comclear(name: string) { */ //#background export function bind(key: string, ...bindarr: string[]) { + // Convert key to internal representation + key = mapstrToKeyseq(key).map(k => k.toMapstr()).join("") if (bindarr.length) { let exstring = bindarr.join(" ") config.set("nmaps", key, exstring) @@ -2338,6 +2341,8 @@ export function blacklistadd(url: string) { */ //#background export async function unbind(key: string) { + // Convert key to internal representation + key = mapstrToKeyseq(key).map(k => k.toMapstr()).join("") config.set("nmaps", key, "") }