1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 22:37:58 +01:00

Don't explicitly pop Menu mode on menu_<Esc>. Closes issue #527. Normalize mode docs to Name rather than NAME.

This commit is contained in:
Kris Maglione
2011-07-29 03:58:49 -04:00
parent 2c59c01232
commit c165fd95be
6 changed files with 23 additions and 19 deletions

View File

@@ -1680,7 +1680,7 @@ var Buffer = Module("buffer", {
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["i", "<Insert>"], mappings.add([modes.NORMAL], ["i", "<Insert>"],
"Start CARET mode", "Start Caret mode",
function () { modes.push(modes.CARET); }); function () { modes.push(modes.CARET); });
mappings.add([modes.NORMAL], ["<C-c>", "<stop-load>"], mappings.add([modes.NORMAL], ["<C-c>", "<stop-load>"],

View File

@@ -1860,7 +1860,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
}); });
commands.add(["norm[al]"], commands.add(["norm[al]"],
"Execute NORMAL mode commands", "Execute Normal mode commands",
function (args) { events.feedkeys(args[0], args.bang, false, modes.NORMAL); }, function (args) { events.feedkeys(args[0], args.bang, false, modes.NORMAL); },
{ {
argCount: "1", argCount: "1",

View File

@@ -729,15 +729,15 @@ var Editor = Module("editor", {
// visual mode // visual mode
mappings.add([modes.CARET, modes.TEXT_EDIT], mappings.add([modes.CARET, modes.TEXT_EDIT],
["v"], "Start VISUAL mode", ["v"], "Start Visual mode",
function () { modes.push(modes.VISUAL); }); function () { modes.push(modes.VISUAL); });
mappings.add([modes.VISUAL], mappings.add([modes.VISUAL],
["v", "V"], "End VISUAL mode", ["v", "V"], "End Visual mode",
function () { modes.pop(); }); function () { modes.pop(); });
mappings.add([modes.TEXT_EDIT], mappings.add([modes.TEXT_EDIT],
["V"], "Start VISUAL LINE mode", ["V"], "Start Visual Line mode",
function () { function () {
modes.push(modes.VISUAL, modes.LINE); modes.push(modes.VISUAL, modes.LINE);
editor.executeCommand("cmd_beginLine", 1); editor.executeCommand("cmd_beginLine", 1);
@@ -843,10 +843,10 @@ var Editor = Module("editor", {
function bind() mappings.add.apply(mappings, function bind() mappings.add.apply(mappings,
[[modes.AUTOCOMPLETE]].concat(Array.slice(arguments))) [[modes.AUTOCOMPLETE]].concat(Array.slice(arguments)))
bind(["<Esc>"], "Return to INSERT mode", bind(["<Esc>"], "Return to Insert mode",
function () Events.PASS_THROUGH); function () Events.PASS_THROUGH);
bind(["<C-[>"], "Return to INSERT mode", bind(["<C-[>"], "Return to Insert mode",
function () { events.feedkeys("<Esc>", { skipmap: true }); }); function () { events.feedkeys("<Esc>", { skipmap: true }); });
bind(["<Up>"], "Select the previous autocomplete result", bind(["<Up>"], "Select the previous autocomplete result",
@@ -882,7 +882,7 @@ var Editor = Module("editor", {
}); });
options.add(["insertmode", "im"], options.add(["insertmode", "im"],
"Enter INSERT mode rather than TEXT_EDIT mode when focusing text areas", "Enter Insert mode rather than Text Edit mode when focusing text areas",
"boolean", true); "boolean", true);
} }
}); });

View File

@@ -1182,11 +1182,11 @@ var Hints = Module("hints", {
mappings: function () { mappings: function () {
var myModes = config.browserModes.concat(modes.OUTPUT_MULTILINE); var myModes = config.browserModes.concat(modes.OUTPUT_MULTILINE);
mappings.add(myModes, ["f"], mappings.add(myModes, ["f"],
"Start HINTS mode", "Start Hints mode",
function () { hints.show("o"); }); function () { hints.show("o"); });
mappings.add(myModes, ["F"], mappings.add(myModes, ["F"],
"Start HINTS mode, but open link in a new tab", "Start Hints mode, but open link in a new tab",
function () { hints.show(options.get("activate").has("links") ? "t" : "b"); }); function () { hints.show(options.get("activate").has("links") ? "t" : "b"); });
mappings.add(myModes, [";"], mappings.add(myModes, [";"],

View File

@@ -227,9 +227,10 @@ var Modes = Module("modes", {
XML.ignoreWhitespace = XML.prettyPrinting = false; XML.ignoreWhitespace = XML.prettyPrinting = false;
let res = <ul dactyl:highlight="Dense" xmlns:dactyl={NS}/>; let res = <ul dactyl:highlight="Dense" xmlns:dactyl={NS}/>;
Object.keys(obj).sort().forEach(function (mode) { Object.keys(obj).sort().forEach(function (name) {
res.* += <li><em>{mode}</em>: {modes.getMode(mode).description}{ let mode = modes.getMode(name);
rec(obj[mode]) res.* += <li><em>{mode.displayName}</em>: {mode.description}{
rec(obj[name])
}</li>; }</li>;
}); });
@@ -500,6 +501,8 @@ var Modes = Module("modes", {
description: Messages.Localized(""), description: Messages.Localized(""),
displayName: Class.memoize(function () this.name.split("_").map(util.capitalize).join(" ")),
isinstance: function isinstance(obj) isinstance: function isinstance(obj)
this === obj || this.allBases.indexOf(obj) >= 0 || callable(obj) && this instanceof 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: function initMappings() {
mappings.add([modes.BASE, modes.NORMAL], mappings.add([modes.BASE, modes.NORMAL],
["<Esc>", "<C-[>"], ["<Esc>", "<C-[>"],
"Return to NORMAL mode", "Return to Normal mode",
function () { modes.reset(); }); function () { modes.reset(); });
mappings.add([modes.INPUT, modes.COMMAND, modes.PASS_THROUGH, modes.QUOTE], mappings.add([modes.INPUT, modes.COMMAND, modes.PASS_THROUGH, modes.QUOTE],
@@ -592,12 +595,13 @@ var Modes = Module("modes", {
"Return to the previous mode", "Return to the previous mode",
function () { modes.pop(); }); function () { modes.pop(); });
mappings.add([modes.MENU], ["<C-c>"],
"Leave Menu mode",
function () { modes.pop(); });
mappings.add([modes.MENU], ["<Esc>"], mappings.add([modes.MENU], ["<Esc>"],
"Close the current popup", "Close the current popup",
function () { function () { return Events.PASS_THROUGH; });
modes.pop();
return Events.PASS_THROUGH;
});
mappings.add([modes.MENU], ["<C-[>"], mappings.add([modes.MENU], ["<C-[>"],
"Close the current popup", "Close the current popup",

View File

@@ -166,7 +166,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* @param {string} str The string to capitalize * @param {string} str The string to capitalize
* @returns {string} * @returns {string}
*/ */
capitalize: function capitalize(str) str && str[0].toUpperCase() + str.slice(1), capitalize: function capitalize(str) str && str[0].toUpperCase() + str.slice(1).toLowerCase(),
/** /**
* Returns a RegExp object that matches characters specified in the range * Returns a RegExp object that matches characters specified in the range