1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-16 16:45:46 +01:00

Back out most of the changes accidentally merged from key-processing.

--HG--
extra : rebase_source : a00510584f7e13917f8496e15b7dd36852d98ea7
This commit is contained in:
Kris Maglione
2011-01-27 15:12:33 -05:00
parent 2c3fd51812
commit d16c0b0d06
47 changed files with 9350 additions and 1141 deletions

View File

@@ -614,9 +614,6 @@ var ConfigBase = Class("ConfigBase", {
HelpString[delim]::before content: attr(delim);
HelpString[delim]::after content: attr(delim);
HelpNews position: relative;
HelpNewsOld opacity: .7;
HelpNewsTag position: absolute; left: 100%; padding-left: 1em; color: #527BBD; opacity: .6; white-space: pre;
HelpHead;html|h1,html|h2,html|h3,html|h4;dactyl://help/* {
font-weight: bold;

View File

@@ -15,25 +15,24 @@ var RangeFinder = Module("rangefinder", {
Local: function (dactyl, modules, window) ({
init: function () {
this.dactyl = dactyl;
this.modules = modules;
this.commandline = modules.commandline;
this.modes = modules.modes;
this.window = window;
this.options = modules.options;
this.lastFindPattern = "";
},
get commandline() this.modules.commandline,
get modes() this.modules.modes,
get options() this.modules.options,
get rangeFind() modules.buffer.localStore.rangeFind,
set rangeFind(val) modules.buffer.localStore.rangeFind = val
}),
openPrompt: function (mode) {
this.CommandMode(mode).open();
let backwards = mode == this.modes.FIND_BACKWARD;
this.commandline.open(backwards ? "?" : "/", "", mode);
if (this.rangeFind && this.rangeFind.window.get() === this.window)
this.rangeFind.reset();
this.find("", mode === this.modes.FIND_BACKWARD);
this.find("", backwards);
},
bootstrap: function (str, backward) {
@@ -120,12 +119,8 @@ var RangeFinder = Module("rangefinder", {
this.rangeFind.focus();
},
onCancel: function () {
if (this.rangeFind)
this.rangeFind.cancel();
},
onChange: function (command) {
// Called when the user types a key in the find dialog. Triggers a find attempt if 'incfind' is set
onKeyPress: function (command) {
if (this.options["incfind"]) {
command = this.bootstrap(command);
this.rangeFind.find(command);
@@ -143,6 +138,13 @@ var RangeFinder = Module("rangefinder", {
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
* current buffer.
@@ -161,12 +163,12 @@ var RangeFinder = Module("rangefinder", {
}
}, {
}, {
/* Must come before commandline. */
modes: function (dactyl, modules, window) {
const { commandline, modes } = modules;
const { modes } = modules;
modes.addMode("FIND", {
extended: true,
description: "Find mode, active when typing search input",
bases: [modes.COMMAND_LINE],
input: true
});
modes.addMode("FIND_FORWARD", {
@@ -174,13 +176,22 @@ var RangeFinder = Module("rangefinder", {
description: "Forward Find mode, active when typing search input",
bases: [modes.FIND],
input: true
});
}, { history: "search" });
modes.addMode("FIND_BACKWARD", {
extended: true,
description: "Backward Find mode, active when typing search input",
bases: [modes.FIND],
input: true
});
}, { history: "search" });
},
commandline: function (dactyl, modules, window) {
const { commandline, modes, rangefinder } = modules;
commandline.registerCallback("change", modes.FIND_FORWARD, rangefinder.closure.onKeyPress);
commandline.registerCallback("submit", modes.FIND_FORWARD, rangefinder.closure.onSubmit);
commandline.registerCallback("cancel", modes.FIND_FORWARD, rangefinder.closure.onCancel);
commandline.registerCallback("change", modes.FIND_BACKWARD, rangefinder.closure.onKeyPress);
commandline.registerCallback("submit", modes.FIND_BACKWARD, rangefinder.closure.onSubmit);
commandline.registerCallback("cancel", modes.FIND_BACKWARD, rangefinder.closure.onCancel);
},
commands: function (dactyl, modules, window) {
const { commands, rangefinder } = modules;
@@ -189,22 +200,6 @@ var RangeFinder = Module("rangefinder", {
function () { rangefinder.clear(); },
{ argCount: "0" });
},
commandline: function (dactyl, modules, window) {
this.CommandMode = Class("CommandFindMode", modules.CommandMode, {
init: function init(mode) {
this.mode = mode;
init.supercall(this);
},
historyKey: "find",
get prompt() this.mode === modules.modes.FIND_BACKWARD ? "?" : "/",
onCancel: this.closure.onCancel,
onChange: this.closure.onChange,
onSubmit: this.closure.onSubmit
});
},
mappings: function (dactyl, modules, window) {
const { buffer, config, mappings, modes, rangefinder } = modules;
var myModes = config.browserModes.concat([modes.CARET]);

View File

@@ -61,27 +61,6 @@ var IO = Module("io", {
services.downloadManager.addListener(this.downloadListener);
},
CommandFileMode: Class("CommandFileMode", modules.CommandMode, {
init: function init(prompt, params) {
init.supercall(this);
this.prompt = isArray(prompt) ? prompt : ["Question", prompt];
update(this, params);
},
historyKey: "file",
get mode() modules.modes.FILE_INPUT,
complete: function (context) {
if (this.completer)
this.completer(context);
context = context.fork("files", 0);
modules.completion.file(context);
context.filters = context.filters.concat(this.filters || []);
}
}),
destroy: function destroy() {
services.downloadManager.removeListener(this.downloadListener);
for (let [, plugin] in Iterator(plugins.contexts))
@@ -1025,16 +1004,6 @@ unlet s:cpo_save
}]);
},
modes: function (dactyl, modules, window) {
const { commandline, modes } = modules;
modes.addMode("FILE_INPUT", {
extended: true,
description: "Active when selecting a file",
bases: [modes.COMMAND_LINE],
input: true
});
},
options: function (dactyl, modules, window) {
const { options } = modules;

View File

@@ -176,7 +176,6 @@ var Overlay = Module("Overlay", {
"io",
"mappings",
"marks",
"mow",
"options",
"statusline",
"styles",
@@ -204,14 +203,12 @@ var Overlay = Module("Overlay", {
modules.loaded = loaded;
function init(module) {
let name = module.constructor.className;
function init(func, mod)
function () defineModule.time(module.className || module.constructor.className, mod,
func, modules[name],
func, module,
modules.dactyl, modules, window);
set.add(loaded, name);
set.add(loaded, module.constructor.className);
for (let [mod, func] in Iterator(module.INIT)) {
if (mod in loaded)
init(func, mod)();
@@ -243,7 +240,7 @@ var Overlay = Module("Overlay", {
defineModule.loadLog.push("Load" + (isString(prereq) ? " " + prereq + " dependency: " : ": ") + module.className);
if (frame && frame.filename)
defineModule.loadLog.push(" from: " + frame.filename.replace(/.* -> /, "") + ":" + frame.lineNumber);
defineModule.loadLog.push(" from: " + frame.filename + ":" + frame.lineNumber);
delete modules[module.className];
modules[module.className] = defineModule.time(module.className, "init", module);