From 9ba3635bc120366086e557c88237d4236a1ba162 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sat, 12 Mar 2011 12:18:26 -0500 Subject: [PATCH] Fix rangefinder search history issue. --- common/content/commandline.js | 12 ++++++------ common/content/dactyl.js | 2 +- common/content/events.js | 11 +++++------ common/modules/finder.jsm | 5 +++++ 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/common/content/commandline.js b/common/content/commandline.js index 3e80a3d1..ce9148b0 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -399,14 +399,13 @@ var CommandMode = Class("CommandMode", { return true; /* Pass event */ }, - onCancel: function (value) { - }, + onCancel: function (value) {}, - onChange: function (value) { - }, + onChange: function (value) {}, - onSubmit: function (value) { - }, + onHistory: function (value) {}, + + onSubmit: function (value) {}, resetCompletions: function resetCompletions() { if (this.completions) { @@ -941,6 +940,7 @@ var CommandLine = Module("commandline", { if (this.completions) this.completions.previewClear(); this.input.value = val; + this.session.onHistory(val); }, /** diff --git a/common/content/dactyl.js b/common/content/dactyl.js index fda79b16..c71b3d99 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -346,7 +346,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { echoerr: function echoerr(str, flags) { flags |= commandline.APPEND_TO_MESSAGES; - if (isinstance(str, ["Error", "Exception"]) || isinstance(str, [XPCWrappedNative_NoHelper]) && /^\[Exception/.test(str)) + if (isinstance(str, ["Error", "Exception"]) || isinstance(str, ["XPCWrappedNative_NoHelper"]) && /^\[Exception/.test(str)) dactyl.reportError(str); if (isObject(str) && "echoerr" in str) str = str.echoerr; diff --git a/common/content/events.js b/common/content/events.js index 90ccbbd3..2052e6b4 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -103,10 +103,6 @@ var ProcessorStack = Class("ProcessorStack", { events.dbg("RESULT: " + length + " " + this._result(result)); - if (result === Events.PASS || result === Events.PASS_THROUGH) - if (this.events[0].originalTarget) - this.events[0].originalTarget.dactylKeyPress = undefined; - if (result !== Events.PASS || this.events.length > 1) if (result !== Events.ABORT || !this.events[0].isReplay) Events.kill(this.events[this.events.length - 1]); @@ -327,6 +323,9 @@ var EventHive = Class("EventHive", Contexts.Hive, { [,, capture, allowUntrusted] = arguments; } + if (set.has(events, "input") && !set.has(events, "dactyl-input")) + events["dactyl-input"] = events.input; + for (let [event, callback] in Iterator(events)) { let args = [Cu.getWeakReference(target), event, @@ -731,7 +730,7 @@ var Events = Module("events", { } }; const TYPES = { - change: "", input: "", submit: "", + change: "", "dactyl-input": "", input: "", submit: "", click: "Mouse", mousedown: "Mouse", mouseup: "Mouse", mouseover: "Mouse", mouseout: "Mouse", keypress: "Key", keyup: "Key", keydown: "Key" @@ -1199,7 +1198,7 @@ var Events = Module("events", { elem.dactylKeyPress = elem.value; util.timeout(function () { if (elem.dactylKeyPress !== undefined && elem.value !== elem.dactylKeyPress) - events.dispatch(elem, events.create(elem.ownerDocument, "input")); + events.dispatch(elem, events.create(elem.ownerDocument, "dactyl-input")); elem.dactylKeyPress = undefined; }); } diff --git a/common/modules/finder.jsm b/common/modules/finder.jsm index 5edd5904..54ea364c 100644 --- a/common/modules/finder.jsm +++ b/common/modules/finder.jsm @@ -132,6 +132,10 @@ var RangeFinder = Module("rangefinder", { } }, + onHistory: function () { + this.rangeFind.found = false; + }, + onSubmit: function (command) { if (!this.options["incfind"] || !this.rangeFind || !this.rangeFind.found) { this.clear(); @@ -200,6 +204,7 @@ var RangeFinder = Module("rangefinder", { get onCancel() modules.rangefinder.closure.onCancel, get onChange() modules.rangefinder.closure.onChange, + get onHistory() modules.rangefinder.closure.onHistory, get onSubmit() modules.rangefinder.closure.onSubmit }); },