From 61476fca47230959b9417ec5034633e04b096413 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sat, 12 Feb 2011 19:52:53 -0500 Subject: [PATCH] Ignore arg/motion maps when shorter matching map is found. Closes issue #365. --- common/content/events.js | 18 +++++++++++------- common/modules/base.jsm | 10 ++++++++-- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/common/content/events.js b/common/content/events.js index 8f24ebeb..5f0aff14 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -44,12 +44,7 @@ var ProcessorStack = Class("ProcessorStack", { if (this.ownsBuffer) statusline.updateInputBuffer(this.processors.length ? this.buffer : ""); - if (this.processors.length) { - result = Events.KILL; - if (this.actions.length && options["timeout"]) - this.timer = services.Timer(this, options["timeoutlen"], services.Timer.TYPE_ONE_SHOT); - } - else if (this.actions.length) { + if (!this.processors.some(function (p) !p.extended) && this.actions.length) { if (this._actions.length == 0) { dactyl.beep(); events.feedingKeys = false; @@ -60,6 +55,13 @@ var ProcessorStack = Class("ProcessorStack", { events.dbg("ACTION RES: " + res); } result = res === Events.PASS ? Events.PASS : Events.KILL; + if (res !== Events.PASS) + this.processors.length = 0; + } + else if (this.processors.length) { + result = Events.KILL; + if (this.actions.length && options["timeout"]) + this.timer = services.Timer(this, options["timeoutlen"], services.Timer.TYPE_ONE_SHOT); } else if (result !== Events.KILL && !this.actions.length && (this.events.length > 1 || @@ -98,7 +100,7 @@ var ProcessorStack = Class("ProcessorStack", { if (force && this.processors.length === 0) events.processor = null; - return this.processors.length == 0; + return this.processors.length === 0; }, process: function process(event) { @@ -238,6 +240,8 @@ var KeyArgProcessor = Class("KeyArgProcessor", KeyProcessor, { this.wantCount = wantCount; }, + extended: true, + onKeyPress: function onKeyPress(event) { if (Events.isEscape(event)) return Events.KILL; diff --git a/common/modules/base.jsm b/common/modules/base.jsm index 3bb15b81..b8407a1c 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -627,7 +627,10 @@ function update(target) { func.supercall = function supercall(self) func.superapply(self, Array.slice(arguments, 1)); } - Object.defineProperty(target, k, desc); + try { + Object.defineProperty(target, k, desc); + } + catch (e) {} }); } return target; @@ -829,8 +832,9 @@ memoize(Class.prototype, "closure", function () { try { return fn.apply(self, arguments); } - catch (e) { + catch (e if !(e instanceof FailedAssertion)) { util.reportError(e); + throw e.stack ? e : Error(e); } } iter(properties(this), properties(this, true)).forEach(function (k) { @@ -838,6 +842,8 @@ memoize(Class.prototype, "closure", function () { closure[k] = closure(this[k]); else if (!(k in closure)) Object.defineProperty(closure, k, { + configurable: true, + enumerable: true, get: function get_proxy() self[k], set: function set_proxy(val) self[k] = val, });