From c177a35a39a625c9f70becac399306e89ff79063 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 21 Jul 2011 03:57:12 -0400 Subject: [PATCH] Expand in feedkeys. --- common/content/events.js | 3 +++ common/content/mappings.js | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/common/content/events.js b/common/content/events.js index 59e88472..50c6adc5 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -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" }; diff --git a/common/content/mappings.js b/common/content/mappings.js index cae1ccc1..58d9e6a9 100644 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -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(//i, options["mapleader"]), + expandLeader: function expandLeader(keyString) keyString.replace(//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)])