1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 16:22:27 +01:00

Get rid of a lot of special casing in the event loops. Merge default.

--HG--
branch : mode-refactoring
This commit is contained in:
Kris Maglione
2010-10-10 15:19:27 -04:00
parent c977268278
commit d7ff35c565
13 changed files with 129 additions and 159 deletions

View File

@@ -567,7 +567,9 @@ const CommandLine = Module("commandline", {
this._startHints = false;
if (!(modes.extended & modes.OUTPUT_MULTILINE))
modes.push(modes.COMMAND_LINE, modes.OUTPUT_MULTILINE);
modes.push(modes.COMMAND_LINE, modes.OUTPUT_MULTILINE, {
onEvent: this.closure.onMultilineOutputEvent
});
// If it's already XML, assume it knows what it's doing.
// Otherwise, white space is significant.
@@ -695,14 +697,13 @@ const CommandLine = Module("commandline", {
cancel: extra.onCancel
};
modes.push(modes.COMMAND_LINE, modes.PROMPT | extra.extended, {
enter: function (stack) { extra.enter && extra.enter(stack); },
leave: function (stack) {
commandline.leave(stack);
if (extra.leave)
extra.leave(stack);
}
});
modes.push(modes.COMMAND_LINE, modes.PROMPT | extra.extended,
update(Object.create(extra), {
leave: function leave(stack) {
commandline.leave(stack);
leave.supercall(this, stack);
}
}));
this.currentExtendedMode = modes.PROMPT;
this.widgets.prompt = !prompt ? null : [extra.promptHighlight || "Question", prompt];
@@ -934,14 +935,7 @@ const CommandLine = Module("commandline", {
}
if (event instanceof MouseEvent)
return;
if (this._startHints) {
statusline.updateInputBuffer("");
this._startHints = false;
hints.show(key, { window: win });
return;
}
return false;
function isScrollable() !win.scrollMaxY == 0;
function atEnd() win.scrollY / win.scrollMaxY >= 1;
@@ -953,7 +947,7 @@ const CommandLine = Module("commandline", {
case ":":
commandline.open(":", "", modes.EX);
return;
return false;
// down a line
case "j":
@@ -1065,9 +1059,8 @@ const CommandLine = Module("commandline", {
break;
case ";":
statusline.updateInputBuffer(";");
this._startHints = true;
break;
hints.open(";", { window: win });
return false;
// unmapped key
default:
@@ -1085,6 +1078,7 @@ const CommandLine = Module("commandline", {
}
else
commandline.updateMorePrompt(showMorePrompt, showMoreHelpPrompt);
return false;
},
getSpaceNeeded: function getSpaceNeeded() {