1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-09 15:05:47 +01:00

Ignore 'passkeys' key chains begining with ordinary characters in input modes.

This commit is contained in:
Kris Maglione
2011-02-20 18:38:31 -05:00
parent 211091d79d
commit 568bee6839
3 changed files with 39 additions and 23 deletions

View File

@@ -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))) && (!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 () { notify: function () {
@@ -1549,27 +1550,30 @@ var Events = Module("events", {
{ count: true }); { count: true });
}, },
options: function () { 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"], options.add(["passkeys", "pk"],
"Pass certain keys through directly for the given URLs", "Pass certain keys through directly for the given URLs",
"sitemap", "", { "sitemap", "", {
flush: function flush() { flush: function flush() {
memoize(this, "hive", function hive() memoize(this, "filters", function () this.value.filter(function (f) f(buffer.documentURI)));
let (values = this.value.filter(function (f) f(buffer.documentURI))) { memoize(this, "pass", function () set(array.flatten(this.filters.map(function (f) f.keys))));
get active() this.stack.length, memoize(this, "commandHive", function hive() Hive(this.filters, "commandMap"));
memoize(this, "inputHive", function hive() Hive(this.filters, "inputMap"));
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))
});
}, },
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, keepQuotes: true,
@@ -1577,9 +1581,15 @@ var Events = Module("events", {
values.forEach(function (filter) { values.forEach(function (filter) {
let vals = Option.splitList(filter.result); let vals = Option.splitList(filter.result);
filter.keys = events.fromString(vals[0]).map(events.closure.toString); 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, 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(); this.flush();

View File

@@ -1125,9 +1125,19 @@
by &dactyl.appName; in any way. Key names are separated by &dactyl.appName; in any way. Key names are separated
by commas, where the first key name is treated as a list by commas, where the first key name is treated as a list
of individual keys and each subsequent key is treated as 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.
</p> </p>
<example><set opt="passkeys" op="+="><str delim="">mail.google.com</str>:<str delim="">jk&lt;Return></str>,<str delim="">gi</str></set></example> <example><set opt="passkeys" op="+="><str delim="">mail.google.com</str>:<str delim="">jk&lt;Return></str>,<str delim="">gi</str></set></example>
<p>
More subtle and complex pass through can be achieved
using <k>groups</k> and mode-specific mappings utilizing
the <k name="Pass"/> pseudo-key.
</p>
</description> </description>
</item> </item>

View File

@@ -112,12 +112,10 @@ window[dactyl|highlight~=Bell] > * {
} }
[dactyl|highlight~=CmdLine] { [dactyl|highlight~=CmdLine] {
/* background: inherit !important; */
color: inherit !important; color: inherit !important;
} }
.dactyl-status-field-url { .dactyl-status-field-url {
/* background-color: inherit !important; */
color: inherit !important; color: inherit !important;
} }
@@ -137,10 +135,8 @@ label[collapsed=true] {
.dactyl-completions { .dactyl-completions {
-moz-user-focus: ignore; -moz-user-focus: ignore;
overflow: -moz-scrollbars-none !important; /* does not seem to work fully */
border-width: 0px !important; border-width: 0px !important;
border-top: 1px solid black !important; border-top: 1px solid black !important;
/*-moz-appearance: none !important; /* prevent an ugly 3D border */
} }
/* fixes the min-height: 22px from firefox */ /* fixes the min-height: 22px from firefox */