1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-19 18:27:59 +01:00

First work towards cleaning up the commandline.js rat's nest. Don't expect any of these new interfaces to stay remotely as they are.

--HG--
branch : key-processing
This commit is contained in:
Kris Maglione
2011-01-26 01:24:54 -05:00
parent a66864d077
commit c284e1ced8
18 changed files with 829 additions and 790 deletions

View File

@@ -119,12 +119,6 @@ var Modes = Module("modes", {
input: true,
ownsFocus: true
});
this.addMode("COMMAND_LINE", {
char: "c",
description: "Active when the command line is focused",
input: true
});
this.addMode("EMBED", {
input: true,
@@ -160,18 +154,6 @@ var Modes = Module("modes", {
input: true
});
// this._extended modes, can include multiple modes, and even main modes
this.addMode("EX", {
extended: true,
description: "Ex command mode, active when the command line is open for Ex commands",
input: true
}, { history: "command" });
this.addMode("HINTS", {
extended: true,
description: "Active when selecting elements in QuickHint or ExtendedHint mode",
count: false,
ownsBuffer: true
});
this.addMode("INPUT_MULTILINE", {
extended: true,
hidden: true,
@@ -180,11 +162,6 @@ var Modes = Module("modes", {
this.addMode("LINE", {
extended: true, hidden: true
});
this.addMode("PROMPT", {
extended: true,
description: "Active when a prompt is open in the command line",
input: true
});
this.push(this.NORMAL, 0, {
enter: function (stack, prev) {
@@ -214,9 +191,9 @@ var Modes = Module("modes", {
_getModeMessage: function () {
// when recording a macro
let macromode = "";
if (modes.recording)
if (this.recording)
macromode = "recording";
else if (modes.replaying)
else if (this.replaying)
macromode = "replaying";
let val = this._modeMap[this._main].display();
@@ -317,13 +294,15 @@ var Modes = Module("modes", {
}
if (stack && stack.pop && stack.pop.params.leave)
stack.pop.params.leave(stack, this.topOfStack);
dactyl.trapErrors("leave", stack.pop.params,
stack, this.topOfStack);
let push = mainMode != null && !(stack && stack.pop) &&
Modes.StackElement(this._main, this._extended, params, {});
if (push && this.topOfStack) {
if (this.topOfStack.params.leave)
this.topOfStack.params.leave({ push: push }, push);
dactyl.trapErrors("leave", this.topOfStack.params,
{ push: push }, push);
for (let [id, { obj, prop }] in Iterator(this.boundProperties)) {
if (!obj.get())
delete this.boundProperties[id];
@@ -332,7 +311,7 @@ var Modes = Module("modes", {
}
}
this.delayed.forEach(function ([fn, self]) fn.call(self));
let delayed = this.delayed;
this.delayed = [];
let prev = stack && stack.pop || this.topOfStack;
@@ -343,9 +322,14 @@ var Modes = Module("modes", {
for (let { obj, prop, value } in values(this.topOfStack.saved))
obj[prop] = value;
this.show();
delayed.forEach(function ([fn, self]) dactyl.trapErrors(fn, self));
if (this.topOfStack.params.enter && prev)
this.topOfStack.params.enter(push ? { push: push } : stack || {},
prev);
dactyl.trapErrors("enter", this.topOfStack.params,
push ? { push: push } : stack || {},
prev);
dactyl.triggerObserver("modeChange", [oldMain, oldExtended], [this._main, this._extended], stack);
this.show();
@@ -439,7 +423,7 @@ var Modes = Module("modes", {
input: false,
passUnknown: false,
get passUnknown() this.input,
get mask() this,