1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 17:57:59 +01:00

Make 'showmode' a regexplist to satisfy whiny pansies who can't tolerate seeing -- EX -- in the status line.

This commit is contained in:
Kris Maglione
2011-02-19 04:06:42 -05:00
parent 3132b2de22
commit caaef0214b
4 changed files with 19 additions and 16 deletions

View File

@@ -1503,10 +1503,6 @@ var CommandLine = Module("commandline", {
"Number of messages to store in the :messages history", "Number of messages to store in the :messages history",
"number", 100, "number", 100,
{ validator: function (value) value >= 0 }); { validator: function (value) value >= 0 });
options.add(["showmode", "smd"],
"Show the current mode in the command line",
"boolean", true);
}, },
sanitizer: function init_sanitizer() { sanitizer: function init_sanitizer() {
sanitizer.addItem("commandline", { sanitizer.addItem("commandline", {

View File

@@ -53,8 +53,7 @@ var Modes = Module("modes", {
this.addMode("NORMAL", { this.addMode("NORMAL", {
char: "n", char: "n",
description: "Active when nothing is focused", description: "Active when nothing is focused",
bases: [this.COMMAND], bases: [this.COMMAND]
display: function () null
}); });
this.addMode("VISUAL", { this.addMode("VISUAL", {
char: "v", char: "v",
@@ -120,7 +119,7 @@ var Modes = Module("modes", {
}); });
this.addMode("AUTOCOMPLETE", { this.addMode("AUTOCOMPLETE", {
description: "Active when an input autocomplete pop-up is active", description: "Active when an input autocomplete pop-up is active",
display: function () "INSERT (autocomplete)", display: function () "AUTOCOMPLETE (insert)",
bases: [this.INSERT] bases: [this.INSERT]
}); });
@@ -143,9 +142,10 @@ var Modes = Module("modes", {
bases: [this.BASE], bases: [this.BASE],
hidden: true, hidden: true,
passthrough: true, passthrough: true,
display: function () modes.getStack(1).main == modes.PASS_THROUGH display: function ()
? (modes.getStack(2).main.display() || modes.getStack(2).main.name) + " (next)" (modes.getStack(1).main == modes.PASS_THROUGH
: "PASS THROUGH (next)" ? (modes.getStack(2).main.display() || modes.getStack(2).main.name)
: "PASS THROUGH") + " (next)"
}, { }, {
// Fix me. // Fix me.
preExecute: function (map) { if (modes.main == modes.QUOTE && map.name !== "<C-v>") modes.pop(); }, preExecute: function (map) { if (modes.main == modes.QUOTE && map.name !== "<C-v>") modes.pop(); },
@@ -268,7 +268,7 @@ var Modes = Module("modes", {
// show the current mode string in the command line // show the current mode string in the command line
show: function show() { show: function show() {
let msg = null; let msg = null;
if (options["showmode"]) if (options.get("showmode").getKey(this.main.name, true))
msg = this._getModeMessage(); msg = this._getModeMessage();
if (loaded.commandline) if (loaded.commandline)
commandline.widgets.mode = msg || null; commandline.widgets.mode = msg || null;
@@ -509,7 +509,7 @@ var Modes = Module("modes", {
}, desc)); }, desc));
} }
}, { }, {
mappings: function () { 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",
@@ -528,7 +528,13 @@ var Modes = Module("modes", {
"Close the current popup", "Close the current popup",
function () { events.feedkeys("<Esc>"); }); function () { events.feedkeys("<Esc>"); });
}, },
prefs: function () { options: function initOptions() {
options.add(["showmode", "smd"],
"Show the current mode in the command line when it matches this expression",
"regexplist", "!^normal$",
{ regexpFlags: "i" });
},
prefs: function initPrefs() {
prefs.watch("accessibility.browsewithcaret", function () modes.onCaretChange.apply(modes, arguments)); prefs.watch("accessibility.browsewithcaret", function () modes.onCaretChange.apply(modes, arguments));
} }
}); });

View File

@@ -1318,10 +1318,10 @@
<tags>'nosmd' 'noshowmode'</tags> <tags>'nosmd' 'noshowmode'</tags>
<tags>'smd' 'showmode'</tags> <tags>'smd' 'showmode'</tags>
<spec>'showmode' 'smd'</spec> <spec>'showmode' 'smd'</spec>
<type>boolean</type> <type>regexplist</type>
<default>on</default> <default>!^normal$</default>
<description> <description>
<p>Show the current mode in the command line.</p> <p>Show the current mode in the command line if it matches this expression.</p>
</description> </description>
</item> </item>

View File

@@ -131,6 +131,7 @@
* IMPORTANT option changes: * IMPORTANT option changes:
- 'hinttags' and 'extendedhinttags' now treat their values as - 'hinttags' and 'extendedhinttags' now treat their values as
CSS selectors by default. [b6] CSS selectors by default. [b6]
- 'showmode' is now a regexplist. [b6]
- Option value quoting has changed. List options will - Option value quoting has changed. List options will
no longer be split at quoted commas and the option name, operators, and no longer be split at quoted commas and the option name, operators, and
= sign may no longer be quoted. This will break certain = sign may no longer be quoted. This will break certain