diff options
author | Kris Maglione <maglione.k@gmail.com> | 2011-07-29 03:58:49 -0400 |
---|---|---|
committer | Kris Maglione <maglione.k@gmail.com> | 2011-07-29 03:58:49 -0400 |
commit | c165fd95be7cba39309400ce9d478b86623ae320 (patch) | |
tree | 3db4d8607540909cb4fcfd7ee7dfab83e73faa24 /common/content/modes.js | |
parent | 2c59c01232593776f296086c609f84123708c615 (diff) | |
download | pentadactyl-c165fd95be7cba39309400ce9d478b86623ae320.tar.gz |
Don't explicitly pop Menu mode on menu_<Esc>. Closes issue #527. Normalize mode docs to Name rather than NAME.
Diffstat (limited to 'common/content/modes.js')
-rw-r--r-- | common/content/modes.js | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/common/content/modes.js b/common/content/modes.js index c54dded9..6f1d7dbd 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -227,9 +227,10 @@ var Modes = Module("modes", { XML.ignoreWhitespace = XML.prettyPrinting = false; let res = <ul dactyl:highlight="Dense" xmlns:dactyl={NS}/>; - Object.keys(obj).sort().forEach(function (mode) { - res.* += <li><em>{mode}</em>: {modes.getMode(mode).description}{ - rec(obj[mode]) + Object.keys(obj).sort().forEach(function (name) { + let mode = modes.getMode(name); + res.* += <li><em>{mode.displayName}</em>: {mode.description}{ + rec(obj[name]) }</li>; }); @@ -500,6 +501,8 @@ var Modes = Module("modes", { description: Messages.Localized(""), + displayName: Class.memoize(function () this.name.split("_").map(util.capitalize).join(" ")), + isinstance: function isinstance(obj) this === obj || this.allBases.indexOf(obj) >= 0 || callable(obj) && this instanceof obj, @@ -584,7 +587,7 @@ var Modes = Module("modes", { mappings: function initMappings() { mappings.add([modes.BASE, modes.NORMAL], ["<Esc>", "<C-[>"], - "Return to NORMAL mode", + "Return to Normal mode", function () { modes.reset(); }); mappings.add([modes.INPUT, modes.COMMAND, modes.PASS_THROUGH, modes.QUOTE], @@ -592,12 +595,13 @@ var Modes = Module("modes", { "Return to the previous mode", function () { modes.pop(); }); + mappings.add([modes.MENU], ["<C-c>"], + "Leave Menu mode", + function () { modes.pop(); }); + mappings.add([modes.MENU], ["<Esc>"], "Close the current popup", - function () { - modes.pop(); - return Events.PASS_THROUGH; - }); + function () { return Events.PASS_THROUGH; }); mappings.add([modes.MENU], ["<C-[>"], "Close the current popup", |