diff --git a/common/content/dactyl.js b/common/content/dactyl.js index e2ce6921..a19dd8a6 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -617,7 +617,7 @@ const Dactyl = Module("dactyl", { }, /** - * Generates a help entry. + * Generates a help entry and writes it to the clipboard. * * @param {Command|Map|Option} obj A dactyl Command, * Map or Option object @@ -642,7 +642,7 @@ const Dactyl = Module("dactyl", { let br = <> ; - return <> + dactyl.clipboardWrite(<> {template.map(obj.names, tag, " ")} {spec((obj.specs || obj.names)[0])}{ @@ -654,7 +654,7 @@ const Dactyl = Module("dactyl", { extraHelp ? br+extraHelp : "" }{ !(extraHelp || obj.description) ? br+

Sorry, no help available.

: "" } -
.toXMLString(); + .toXMLString(), true); }, diff --git a/common/content/events.js b/common/content/events.js index 1158fd03..2102cba7 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -892,7 +892,7 @@ const Events = Module("events", { if (modes.extended & modes.HINTS) { // under HINT mode, certain keys are redirected to hints.onEvent if (key == "" || key == "" || key == "" - || key == mappings.mapLeader + || key == options["mapleader"] || (key == "" && hints.prevInput == "number") || (hints.isHintKey(key) && !hints.escNumbers)) { hints.onEvent(event); diff --git a/common/content/help.js b/common/content/help.js index 092678aa..3b23994f 100644 --- a/common/content/help.js +++ b/common/content/help.js @@ -8,8 +8,13 @@ function checkFragment() { document.title = document.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "title")[0].textContent; var frag = document.location.hash.substr(1); var elem = document.getElementById(frag); - if (elem) + function action() { window.content.scrollTo(0, window.content.scrollY + elem.getBoundingClientRect().top - 10); // 10px context + } + if (elem) { + action(); + setTimeout(action, 10); + } } document.addEventListener("load", checkFragment, true); diff --git a/common/content/hints.js b/common/content/hints.js index 73bfedf5..a5638970 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -96,7 +96,7 @@ const Hints = Module("hints", { * Display the current status to the user. */ _updateStatusline: function () { - statusline.updateInputBuffer((hints.escNumbers ? mappings.mapLeader : "") + + statusline.updateInputBuffer((hints.escNumbers ? options["mapleader"] : "") + (this._hintNumber ? this.getHintString(this._hintNumber) : "")); }, @@ -863,7 +863,7 @@ const Hints = Module("hints", { } break; - case mappings.mapLeader: + case options["mapleader"]: hints.escNumbers = !hints.escNumbers; if (hints.escNumbers && this._usedTabKey) this._hintNumber = 0; diff --git a/common/content/mappings.js b/common/content/mappings.js index 040d552b..84d3be1e 100644 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -174,7 +174,7 @@ const Mappings = Module("mappings", { } }, - _expandLeader: function (keyString) keyString.replace(//i, mappings.mapLeader), + _expandLeader: function (keyString) keyString.replace(//i, options["mapleader"]), // Return all mappings present in all @modes _mappingsIterator: function (modes, stack) { @@ -289,15 +289,6 @@ const Mappings = Module("mappings", { return matches; }, - /* - * @property {string} The map leader string used to replace the special - * token "" when user mappings are defined. - */ - get mapLeader() dactyl.globalVariables["mapleader"] || "\\", - /** @deprecated */ - getMapLeader: function () this.mapLeader, - - /** * Returns whether there is a user-defined mapping cmd for the * specified mode. @@ -589,6 +580,11 @@ const Mappings = Module("mappings", { this._main[mode] = []; this._user[mode] = []; } + }, + options: function () { + options.add(["mapleader", "ml"], + "Defines the replacement keys for the pseudo-key", + "string", "\\"); } }); diff --git a/common/locale/en-US/map.xml b/common/locale/en-US/map.xml index b50a9bf9..a1c8a1b9 100644 --- a/common/locale/en-US/map.xml +++ b/common/locale/en-US/map.xml @@ -349,19 +349,19 @@ - mapleader \]]> + \]]> <Leader>

- Expands to the value of the ‘mapleader’ variable in key mapping. If - ‘mapleader’ is unset or empty then ‘\’ is used. For example, by default, + A pseudo-key which expands to the value of the mapleader + option. For example, by default,

:map h :echo Hello

works like

:map \h :echo Hello

but after

- :let mapleader = , + :set mapleader=,

it works like

:map ,h :echo Hello
diff --git a/common/locale/en-US/options.xml b/common/locale/en-US/options.xml index a94d3978..720235f9 100644 --- a/common/locale/en-US/options.xml +++ b/common/locale/en-US/options.xml @@ -925,6 +925,16 @@
+ + 'ml' 'mapleader' + 'mapleader' + string + \ + +

Defines the replacement keys for the pseudo-key.

+
+
+ 'maxitems' 'maxitems' diff --git a/pentadactyl/NEWS b/pentadactyl/NEWS index 3ac303df..bb041635 100644 --- a/pentadactyl/NEWS +++ b/pentadactyl/NEWS @@ -46,6 +46,8 @@ * IMPORTANT: 'extendedhinttags' is now a regexmap rather than a string. * IMPORTANT: 'guioptions' default value has changed. + * IMPORTANT: 'mapleader' is now an option rather than a :let + variable. * Added g; continued extended hint mode and removed ;F * Added "bookmarks", "diverted", and "links" to 'activate' option diff --git a/pentadactyl/TODO b/pentadactyl/TODO index 07082469..abf079af 100644 --- a/pentadactyl/TODO +++ b/pentadactyl/TODO @@ -27,7 +27,6 @@ BUGS: FEATURES: 9 Add quoting help tag 8 Document Caret and Visual modes. -8 make 'mapleader' an option 8 replace global variables with plugin scoped user options 8 fix local options 8 adaptive timeout for auto-completions, :set completions can be updated more often than