mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 21:38:11 +01:00
Fix finder.
--HG-- branch : key-processing
This commit is contained in:
@@ -381,7 +381,6 @@ var CommandMode = Class("CommandMode", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
autocomplete: false,
|
|
||||||
keepCommand: false,
|
keepCommand: false,
|
||||||
|
|
||||||
onKeyPress: function onKeyPress(event) {
|
onKeyPress: function onKeyPress(event) {
|
||||||
@@ -392,9 +391,6 @@ var CommandMode = Class("CommandMode", {
|
|||||||
return true; /* Pass event */
|
return true; /* Pass event */
|
||||||
},
|
},
|
||||||
|
|
||||||
complete: function (context) {
|
|
||||||
},
|
|
||||||
|
|
||||||
onCancel: function (value) {
|
onCancel: function (value) {
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -818,7 +818,7 @@ memoize(Class.prototype, "closure", function () {
|
|||||||
iter(properties(this), properties(this, true)).forEach(function (k) {
|
iter(properties(this), properties(this, true)).forEach(function (k) {
|
||||||
if (!this.__lookupGetter__(k) && callable(this[k]))
|
if (!this.__lookupGetter__(k) && callable(this[k]))
|
||||||
closure[k] = closure(this[k]);
|
closure[k] = closure(this[k]);
|
||||||
else if (!(k in closure || k in Object.prototype))
|
else if (!(k in closure))
|
||||||
Object.defineProperty(closure, k, {
|
Object.defineProperty(closure, k, {
|
||||||
get: function get_proxy() self[k],
|
get: function get_proxy() self[k],
|
||||||
set: function set_proxy(val) self[k] = val,
|
set: function set_proxy(val) self[k] = val,
|
||||||
|
|||||||
@@ -22,19 +22,18 @@ var RangeFinder = Module("rangefinder", {
|
|||||||
|
|
||||||
get commandline() this.modules.commandline,
|
get commandline() this.modules.commandline,
|
||||||
get modes() this.modules.modes,
|
get modes() this.modules.modes,
|
||||||
get options() this.modules.options(),
|
get options() this.modules.options,
|
||||||
|
|
||||||
get rangeFind() modules.buffer.localStore.rangeFind,
|
get rangeFind() modules.buffer.localStore.rangeFind,
|
||||||
set rangeFind(val) modules.buffer.localStore.rangeFind = val
|
set rangeFind(val) modules.buffer.localStore.rangeFind = val
|
||||||
}),
|
}),
|
||||||
|
|
||||||
openPrompt: function (mode) {
|
openPrompt: function (mode) {
|
||||||
let backwards = mode == this.modes.FIND_BACKWARD;
|
this.CommandMode(mode).open();
|
||||||
this.CommandMode(mode).open(backwards ? "?" : "/");
|
|
||||||
|
|
||||||
if (this.rangeFind && this.rangeFind.window.get() === this.window)
|
if (this.rangeFind && this.rangeFind.window.get() === this.window)
|
||||||
this.rangeFind.reset();
|
this.rangeFind.reset();
|
||||||
this.find("", backwards);
|
this.find("", mode === this.modes.FIND_BACKWARD);
|
||||||
},
|
},
|
||||||
|
|
||||||
bootstrap: function (str, backward) {
|
bootstrap: function (str, backward) {
|
||||||
@@ -121,8 +120,12 @@ var RangeFinder = Module("rangefinder", {
|
|||||||
this.rangeFind.focus();
|
this.rangeFind.focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
// Called when the user types a key in the find dialog. Triggers a find attempt if 'incfind' is set
|
onCancel: function () {
|
||||||
onKeyPress: function (command) {
|
if (this.rangeFind)
|
||||||
|
this.rangeFind.cancel();
|
||||||
|
},
|
||||||
|
|
||||||
|
onChange: function (command) {
|
||||||
if (this.options["incfind"]) {
|
if (this.options["incfind"]) {
|
||||||
command = this.bootstrap(command);
|
command = this.bootstrap(command);
|
||||||
this.rangeFind.find(command);
|
this.rangeFind.find(command);
|
||||||
@@ -140,13 +143,6 @@ var RangeFinder = Module("rangefinder", {
|
|||||||
this.rangeFind.focus();
|
this.rangeFind.focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
// Called when the find is canceled - for example if someone presses
|
|
||||||
// escape while typing a find
|
|
||||||
onCancel: function () {
|
|
||||||
if (this.rangeFind)
|
|
||||||
this.rangeFind.cancel();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Highlights all occurrences of the last sought for string in the
|
* Highlights all occurrences of the last sought for string in the
|
||||||
* current buffer.
|
* current buffer.
|
||||||
@@ -165,12 +161,12 @@ var RangeFinder = Module("rangefinder", {
|
|||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
}, {
|
}, {
|
||||||
/* Must come before commandline. */
|
|
||||||
modes: function (dactyl, modules, window) {
|
modes: function (dactyl, modules, window) {
|
||||||
const { modes } = modules;
|
const { commandline, modes } = modules;
|
||||||
modes.addMode("FIND", {
|
modes.addMode("FIND", {
|
||||||
extended: true,
|
extended: true,
|
||||||
description: "Find mode, active when typing search input",
|
description: "Find mode, active when typing search input",
|
||||||
|
bases: [modes.COMMAND_LINE],
|
||||||
input: true
|
input: true
|
||||||
});
|
});
|
||||||
modes.addMode("FIND_FORWARD", {
|
modes.addMode("FIND_FORWARD", {
|
||||||
@@ -194,14 +190,19 @@ var RangeFinder = Module("rangefinder", {
|
|||||||
{ argCount: "0" });
|
{ argCount: "0" });
|
||||||
},
|
},
|
||||||
commandline: function (dactyl, modules, window) {
|
commandline: function (dactyl, modules, window) {
|
||||||
this.CommandMode = modules.CommandMode("CommandFindMode", {
|
this.CommandMode = Class("CommandFindMode", modules.CommandMode, {
|
||||||
init: function init(mode) {
|
init: function init(mode) {
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
|
init.supercall(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
historyKey: "find",
|
historyKey: "find",
|
||||||
onCancel: rangefinder.closure.onCancel,
|
|
||||||
onChange: rangefinder.closure.onKeyPress,
|
get prompt() this.mode === modules.modes.FIND_BACKWARD ? "?" : "/",
|
||||||
onSubmit: rangefinder.closure.onSubmit
|
|
||||||
|
onCancel: this.closure.onCancel,
|
||||||
|
onChange: this.closure.onChange,
|
||||||
|
onSubmit: this.closure.onSubmit
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
mappings: function (dactyl, modules, window) {
|
mappings: function (dactyl, modules, window) {
|
||||||
|
|||||||
@@ -204,12 +204,14 @@ var Overlay = Module("Overlay", {
|
|||||||
modules.loaded = loaded;
|
modules.loaded = loaded;
|
||||||
|
|
||||||
function init(module) {
|
function init(module) {
|
||||||
|
let name = module.constructor.className;
|
||||||
|
|
||||||
function init(func, mod)
|
function init(func, mod)
|
||||||
function () defineModule.time(module.className || module.constructor.className, mod,
|
function () defineModule.time(module.className || module.constructor.className, mod,
|
||||||
func, module,
|
func, modules[name],
|
||||||
modules.dactyl, modules, window);
|
modules.dactyl, modules, window);
|
||||||
|
|
||||||
set.add(loaded, module.constructor.className);
|
set.add(loaded, name);
|
||||||
for (let [mod, func] in Iterator(module.INIT)) {
|
for (let [mod, func] in Iterator(module.INIT)) {
|
||||||
if (mod in loaded)
|
if (mod in loaded)
|
||||||
init(func, mod)();
|
init(func, mod)();
|
||||||
@@ -241,7 +243,7 @@ var Overlay = Module("Overlay", {
|
|||||||
|
|
||||||
defineModule.loadLog.push("Load" + (isString(prereq) ? " " + prereq + " dependency: " : ": ") + module.className);
|
defineModule.loadLog.push("Load" + (isString(prereq) ? " " + prereq + " dependency: " : ": ") + module.className);
|
||||||
if (frame && frame.filename)
|
if (frame && frame.filename)
|
||||||
defineModule.loadLog.push(" from: " + frame.filename + ":" + frame.lineNumber);
|
defineModule.loadLog.push(" from: " + frame.filename.replace(/.* -> /, "") + ":" + frame.lineNumber);
|
||||||
|
|
||||||
delete modules[module.className];
|
delete modules[module.className];
|
||||||
modules[module.className] = defineModule.time(module.className, "init", module);
|
modules[module.className] = defineModule.time(module.className, "init", module);
|
||||||
|
|||||||
Reference in New Issue
Block a user