1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-03 19:14:11 +01:00

Expand <leader> in feedkeys.

This commit is contained in:
Kris Maglione
2011-07-21 03:57:12 -04:00
parent b4936fa481
commit c177a35a39
2 changed files with 7 additions and 4 deletions

View File

@@ -669,6 +669,8 @@ var Events = Module("events", {
if (quiet)
commandline.quiet = quiet;
keys = mappings.expandLeader(keys);
for (let [, evt_obj] in Iterator(events.fromString(keys))) {
let now = Date.now();
let key = events.toString(evt_obj);
@@ -870,6 +872,7 @@ var Events = Module("events", {
let out = [];
for (let match in util.regexp.iterate(/<.*?>?>|[^<]|<(?!.*>)/g, input)) {
let evt_str = match[0];
let evt_obj = { ctrlKey: false, shiftKey: false, altKey: false, metaKey: false,
keyCode: 0, charCode: 0, type: "keypress" };

View File

@@ -306,7 +306,7 @@ var Mappings = Module("mappings", {
get userHives() this.allHives.filter(function (h) h !== this.builtin, this),
expandLeader: function expandLeader(keyString) keyString.replace(/<Leader>/i, options["mapleader"]),
expandLeader: function expandLeader(keyString) keyString.replace(/<Leader>/i, function () options["mapleader"]),
prefixes: Class.memoize(function () {
let list = Array.map("CASM", function (s) s + "-");
@@ -411,11 +411,11 @@ var Mappings = Module("mappings", {
*
* @param {number[]} modes An array of modes to search.
* @param {string} filter The filter string to match.
* @param {[MapHive]} hives The map hives to list. @optional
*/
list: function (modes, filter, hives) {
let modeSign = "";
modes.filter(function (m) m.char).forEach(function (m) { modeSign += m.char; });
modes.filter(function (m) !m.char).forEach(function (m) { modeSign += " " + m.name; });
let modeSign = modes.map(function (m) m.char || "").join("")
+ modes.map(function (m) !m.char ? " " + m.name : "").join("");
modeSign = modeSign.replace(/^ /, "");
hives = (hives || mappings.userHives).map(function (h) [h, maps(h)])