From 568bee6839333aa927afeac6bb6f1a120a0f2dea Mon Sep 17 00:00:00 2001
From: Kris Maglione
Date: Sun, 20 Feb 2011 18:38:31 -0500
Subject: [PATCH] Ignore 'passkeys' key chains begining with ordinary
characters in input modes.
---
common/content/events.js | 46 ++++++++++++++++++++-------------
common/locale/en-US/options.xml | 12 ++++++++-
common/skin/dactyl.css | 4 ---
3 files changed, 39 insertions(+), 23 deletions(-)
diff --git a/common/content/events.js b/common/content/events.js
index d4c796ad..bc2f8379 100644
--- a/common/content/events.js
+++ b/common/content/events.js
@@ -38,9 +38,10 @@ var ProcessorStack = Class("ProcessorStack", {
};
}
- if (!builtin && options.get("passkeys").hive.active
+ let hive = this.main.input ? "inputHive" : "commandHive";
+ if (!builtin && options.get("passkeys")[hive].active
&& (!dactyl.focusedElement || events.isContentNode(dactyl.focusedElement)))
- this.processors.unshift(KeyProcessor(modes.BASE, options.get("passkeys").hive));
+ this.processors.unshift(KeyProcessor(modes.BASE, options.get("passkeys")[hive]));
},
notify: function () {
@@ -1549,27 +1550,30 @@ var Events = Module("events", {
{ count: true });
},
options: function () {
+ const Hive = Class("Hive", {
+ init: function init(values, map) {
+ this.stack = MapHive.Stack(values.map(function (v) v[map]));
+ },
+
+ get active() this.stack.length,
+
+ get: function get(mode, key) this.stack.mappings[key],
+
+ getCandidates: function getCandidates(mode, key) this.stack.candidates[key]
+ });
options.add(["passkeys", "pk"],
"Pass certain keys through directly for the given URLs",
"sitemap", "", {
flush: function flush() {
- memoize(this, "hive", function hive()
- let (values = this.value.filter(function (f) f(buffer.documentURI))) {
- get active() this.stack.length,
-
- get: function get(mode, key) this.stack.mappings[key],
-
- getCandidates: function getCandidates(mode, key) this.stack.candidates[key],
-
- pass: set(array.flatten(values.map(function (v) v.keys))),
-
- stack: MapHive.Stack(values.map(function (v) v.map))
- });
+ memoize(this, "filters", function () this.value.filter(function (f) f(buffer.documentURI)));
+ memoize(this, "pass", function () set(array.flatten(this.filters.map(function (f) f.keys))));
+ memoize(this, "commandHive", function hive() Hive(this.filters, "commandMap"));
+ memoize(this, "inputHive", function hive() Hive(this.filters, "inputMap"));
},
- has: function (key) set.has(this.hive.pass, key) || set.has(this.hive.stack.mappings, key),
+ has: function (key) set.has(this.pass, key) || set.has(this.commandHive.stack.mappings, key),
- get hive() (this.flush(), this.hive),
+ get pass() (this.flush(), this.pass),
keepQuotes: true,
@@ -1577,9 +1581,15 @@ var Events = Module("events", {
values.forEach(function (filter) {
let vals = Option.splitList(filter.result);
filter.keys = events.fromString(vals[0]).map(events.closure.toString);
- filter.map = {
+
+ let keys = vals.slice(1).map(events.closure.canonicalKeys);
+ filter.commandMap = {
execute: function () Events.PASS_THROUGH,
- keys: vals.slice(1).map(events.closure.canonicalKeys)
+ keys: keys
+ };
+ filter.inputMap = {
+ execute: function () Events.PASS_THROUGH,
+ keys: keys.filter(/^<[ACM]-/)
};
});
this.flush();
diff --git a/common/locale/en-US/options.xml b/common/locale/en-US/options.xml
index a5988e98..52e07a16 100644
--- a/common/locale/en-US/options.xml
+++ b/common/locale/en-US/options.xml
@@ -1125,9 +1125,19 @@
by &dactyl.appName; in any way. Key names are separated
by commas, where the first key name is treated as a list
of individual keys and each subsequent key is treated as
- a key chain.
+ a key chain. Individual key entries always apply to all
+ modes. Key chains apply only to non-input modes unless
+ they begin with a key requiring a modifier other than
+ shift.
+
mail.google.com:jk<Return>,gi
+
+
+ More subtle and complex pass through can be achieved
+ using groups and mode-specific mappings utilizing
+ the pseudo-key.
+
diff --git a/common/skin/dactyl.css b/common/skin/dactyl.css
index 7051dfd9..57b01d3c 100644
--- a/common/skin/dactyl.css
+++ b/common/skin/dactyl.css
@@ -112,12 +112,10 @@ window[dactyl|highlight~=Bell] > * {
}
[dactyl|highlight~=CmdLine] {
- /* background: inherit !important; */
color: inherit !important;
}
.dactyl-status-field-url {
- /* background-color: inherit !important; */
color: inherit !important;
}
@@ -137,10 +135,8 @@ label[collapsed=true] {
.dactyl-completions {
-moz-user-focus: ignore;
- overflow: -moz-scrollbars-none !important; /* does not seem to work fully */
border-width: 0px !important;
border-top: 1px solid black !important;
- /*-moz-appearance: none !important; /* prevent an ugly 3D border */
}
/* fixes the min-height: 22px from firefox */