diff --git a/common/content/commandline.js b/common/content/commandline.js index 8f827d28..a9360735 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -994,7 +994,7 @@ var CommandLine = Module("commandline", { if (this._completions) this._completions.previewClear(); if (!this.currentExtendedMode) - return Events.isEscape(event) ? KILL : PASS; + return PASS; // user pressed to carry out a command // user pressing is handled in the global onEscape @@ -1028,7 +1028,7 @@ var CommandLine = Module("commandline", { } } // allow this event to be handled by the host app - return Events.isEscape(event) ? KILL : PASS; + return PASS; } else if (event.type == "keyup") { let key = events.toString(event); diff --git a/common/content/events.js b/common/content/events.js index d40252a2..dab81df1 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -713,27 +713,6 @@ var Events = Module("events", { modes.remove(modes.MENU); }, - /** - * The global escape key handler. This is called in ALL modes. - */ - onEscape: function () { - switch (modes.main) { - case modes.COMMAND_LINE: - case modes.INSERT: - case modes.OUTPUT_MULTILINE: - case modes.PASS_THROUGH: - case modes.QUOTE: - case modes.TEXT_EDIT: - case modes.VISUAL: - modes.pop(); - break; - - default: - modes.reset(); - break; - } - }, - /** * Ensures that the currently focused element is visible and blurs * it if it's not. @@ -1023,9 +1002,6 @@ var Events = Module("events", { refeed.shift(); } - if (Events.isEscape(key) && !shouldPass()) - res = Events.KILL; - if (res !== Events.PASS) kill(event); @@ -1041,11 +1017,6 @@ var Events = Module("events", { catch (e) { dactyl.reportError(e); } - finally { - // This is a stupid, silly, and revolting hack. - if (Events.isEscape(key) && !shouldPass()) - this.onEscape(); - } }, onKeyUpOrDown: function onKeyUpOrDown(event) { diff --git a/common/content/hints.js b/common/content/hints.js index 03fd0169..17e37fad 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -944,7 +944,7 @@ var Hints = Module("hints", { return KILL; } - return Events.isEscape(key) ? KILL : PASS; + return PASS; } //}}} }, { diff --git a/common/content/modes.js b/common/content/modes.js index 4dc372bf..04888f0d 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -489,6 +489,22 @@ var Modes = Module("modes", { }, desc)); } }, { + mappings: function () { + mappings.add([modes.BASE], + ["", ""], + "Return to NORMAL mode", + function () { modes.reset() }); + + mappings.add([modes.INPUT, modes.COMMAND, modes.PASS_THROUGH, modes.QUOTE], + ["", ""], + "Return to the previous mode", + function () { modes.reset() }); + + mappings.add([modes.MENU], + ["", ""], + "Close the current popup", + function () events.PASS); + }, prefs: function () { prefs.watch("accessibility.browsewithcaret", modes.closure.onCaretChange); }