summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorKris Maglione <maglione.k@gmail.com>2011-03-12 10:53:35 -0500
committerKris Maglione <maglione.k@gmail.com>2011-03-12 10:53:35 -0500
commit55267dddff0229cb595a12a7c3a2751d98905b56 (patch)
treeda20aaffbf7d3798c3984c5464581b0fd76798df /common
parentd037f9f1e6b536eb2903ec0b891457fa377b114b (diff)
downloadpentadactyl-55267dddff0229cb595a12a7c3a2751d98905b56.tar.gz
Add 'passunknown' option, currently undocumented.
Diffstat (limited to 'common')
-rw-r--r--common/content/events.js11
-rw-r--r--common/content/modes.js18
2 files changed, 19 insertions, 10 deletions
diff --git a/common/content/events.js b/common/content/events.js
index db127e22..14c25615 100644
--- a/common/content/events.js
+++ b/common/content/events.js
@@ -17,13 +17,13 @@ var ProcessorStack = Class("ProcessorStack", {
this.events = [];
let main = { __proto__: mode.main, params: mode.params };
- let keyModes = array([mode.params.keyModes, main, mode.main.allBases]).flatten().compact();
+ this.modes = array([mode.params.keyModes, main, mode.main.allBases]).flatten().compact();
if (builtin)
hives = hives.filter(function (h) h.name === "builtin");
- this.processors = keyModes.map(function (m) hives.map(function (h) KeyProcessor(m, h)))
- .flatten().array;
+ this.processors = this.modes.map(function (m) hives.map(function (h) KeyProcessor(m, h)))
+ .flatten().array;
this.ownsBuffer = !this.processors.some(function (p) p.main.ownsBuffer);
for (let [i, input] in Iterator(this.processors)) {
@@ -44,6 +44,8 @@ var ProcessorStack = Class("ProcessorStack", {
this.processors.unshift(KeyProcessor(modes.BASE, hive));
},
+ passUnknown: Class.memoize(function () this.modes.some(function (m) m.passUnknown)),
+
notify: function () {
events.keyEvents = [];
events.processor = null;
@@ -89,8 +91,7 @@ var ProcessorStack = Class("ProcessorStack", {
if (options["timeout"])
this.timer = services.Timer(this, options["timeoutlen"], services.Timer.TYPE_ONE_SHOT);
}
- else if (result !== Events.KILL && !this.actions.length &&
- processors.some(function (p) !p.main.passUnknown)) {
+ else if (result !== Events.KILL && !this.actions.length && !this.passUnknown) {
result = Events.ABORT;
if (!Events.isEscape(this.events.slice(-1)[0]))
dactyl.beep();
diff --git a/common/content/modes.js b/common/content/modes.js
index 7889a5af..e30eb2a8 100644
--- a/common/content/modes.js
+++ b/common/content/modes.js
@@ -62,8 +62,7 @@ var Modes = Module("modes", {
description: "Active when text is selected",
display: function () "VISUAL" + (this._extended & modes.LINE ? " LINE" : ""),
bases: [this.COMMAND],
- ownsFocus: true,
- passUnknown: false
+ ownsFocus: true
}, {
leave: function (stack, newMode) {
if (newMode.main == modes.CARET) {
@@ -100,8 +99,7 @@ var Modes = Module("modes", {
description: "Vim-like editing of input elements",
bases: [this.COMMAND],
input: true,
- ownsFocus: true,
- passUnknown: false
+ ownsFocus: true
});
this.addMode("OUTPUT_MULTILINE", {
description: "Active when the multi-line output buffer is open",
@@ -470,7 +468,7 @@ var Modes = Module("modes", {
ownsFocus: Class.memoize(function ownsFocus() this.bases.length && this.bases.some(function (b) b.ownsFocus)),
- get passUnknown() this.input,
+ passUnknown: Class.memoize(function () options.get("passunknown").getKey(this.name)),
get mask() this,
@@ -541,6 +539,16 @@ var Modes = Module("modes", {
function () { events.feedkeys("<Esc>"); });
},
options: function initOptions() {
+ options.add(["passunknown"],
+ "Pass through unknown keys in these modes",
+ "regexplist", "^input$",
+ {
+ regexpFlags: "i",
+ setter: function (val) {
+ modes.all.forEach(function (m) { delete m.passUnknown });
+ }
+ });
+
options.add(["showmode", "smd"],
"Show the current mode in the command line when it matches this expression",
"regexplist", "!^normal$",