diff --git a/common/content/events.js b/common/content/events.js
index c6fa295c..543f9b83 100644
--- a/common/content/events.js
+++ b/common/content/events.js
@@ -19,9 +19,9 @@ var Events = Module("events", {
-
-
.elements()
diff --git a/common/content/finder.js b/common/content/finder.js
index ec4f79c9..5d2ef9a7 100644
--- a/common/content/finder.js
+++ b/common/content/finder.js
@@ -147,8 +147,14 @@ var RangeFinder = Module("rangefinder", {
}, {
modes: function () {
/* Must come before commandline. */
- modes.addMode("FIND_FORWARD", true);
- modes.addMode("FIND_BACKWARD", true);
+ modes.addMode("FIND_FORWARD", {
+ extended: true,
+ description: "Forward Find mode, active when typing search input"
+ });
+ modes.addMode("FIND_BACKWARD", {
+ extended: true,
+ description: "Forward Find mode, active when typing search input"
+ });
},
commandline: function () {
commandline.registerCallback("change", modes.FIND_FORWARD, this.closure.onKeyPress);
diff --git a/common/content/mappings.js b/common/content/mappings.js
index b26d7506..8ad3282c 100644
--- a/common/content/mappings.js
+++ b/common/content/mappings.js
@@ -513,7 +513,7 @@ var Mappings = Module("mappings", {
names: ["-mode", "-m"],
type: CommandOption.STRING,
validator: function (value) Array.concat(value).every(findMode),
- completer: function () [[array.compact([mode.name.toLowerCase().replace(/_/g, "-"), mode.char]), mode.disp]
+ completer: function () [[array.compact([mode.name.toLowerCase().replace(/_/g, "-"), mode.char]), mode.description]
for (mode in values(modes.all))
if (!mode.hidden)],
};
diff --git a/common/content/modes.js b/common/content/modes.js
index 65cf7eac..a6fd816c 100644
--- a/common/content/modes.js
+++ b/common/content/modes.js
@@ -31,15 +31,28 @@ var Modes = Module("modes", {
this._modes = [];
this._mainModes = [];
- this._lastMode = 0;
this._modeMap = {};
this.boundProperties = {};
// main modes, only one should ever be active
- this.addMode("NORMAL", { char: "n", display: function () null });
- this.addMode("INSERT", { char: "i", input: true, ownsFocus: true });
- this.addMode("VISUAL", { char: "v", ownsFocus: true, display: function () "VISUAL" + (this._extended & modes.LINE ? " LINE" : "") }, {
+ this.addMode("NORMAL", {
+ char: "n",
+ description: "Normal mode, active when nothing is focused",
+ display: function () null
+ });
+ this.addMode("INSERT", {
+ char: "i",
+ description: "Insert mode, active when an input element is focused",
+ input: true,
+ ownsFocus: true
+ });
+ this.addMode("VISUAL", {
+ char: "v",
+ description: "Visual mode, active when text is selected",
+ ownsFocus: true,
+ display: function () "VISUAL" + (this._extended & modes.LINE ? " LINE" : "")
+ }, {
leave: function (stack, newMode) {
if (newMode.main == modes.CARET) {
let selection = content.getSelection();
@@ -51,28 +64,49 @@ var Modes = Module("modes", {
}
});
- this.addMode("COMMAND_LINE", { char: "c", input: true });
+ this.addMode("COMMAND_LINE", {
+ char: "c",
+ description: "Command Line mode, active when the command line is focused",
+ input: true
+ });
+
+ this.addMode("CARET", {
+ description: "Caret mode, active when the caret is visible in the web content",
+ }, {
- this.addMode("CARET", {}, {
get pref() prefs.get("accessibility.browsewithcaret"),
set pref(val) prefs.set("accessibility.browsewithcaret", val),
+
enter: function (stack) {
if (stack.pop && !this.pref)
modes.pop();
else if (!stack.pop && !this.pref)
this.pref = true;
},
+
leave: function (stack) {
if (!stack.push && this.pref)
this.pref = false;
}
});
- this.addMode("TEXT_EDIT", { char: "t", ownsFocus: true });
- this.addMode("EMBED", { input: true, ownsFocus: true });
- this.addMode("PASS_THROUGH", { hidden: true });
+ this.addMode("TEXT_EDIT", {
+ char: "t",
+ description: "Text Edit mode, Vim-like editing of input elements",
+ ownsFocus: true
+ });
+ this.addMode("EMBED", {
+ input: true,
+ description: "Embed mode, active when an