1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 13:47:57 +01:00

Don't use modes.clear() to clear the last message and some collateral fixes.

This commit is contained in:
Kris Maglione
2010-09-28 23:01:21 -04:00
parent c2c33b77fb
commit ea6ae88d4e
4 changed files with 21 additions and 17 deletions

View File

@@ -188,9 +188,7 @@ const Browser = Module("browser", {
function () { function () {
window.QueryInterface(Ci.nsIInterfaceRequestor) window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils).redraw(); .getInterface(Ci.nsIDOMWindowUtils).redraw();
commandline.widgets.message = null; commandline.clear();
if (modes.main != modes.COMMAND_LINE)
commandline.widgets.command = null;
}, },
{ argCount: "0" }); { argCount: "0" });
} }

View File

@@ -161,7 +161,7 @@ const Buffer = Module("buffer", {
// called when the active document is scrolled // called when the active document is scrolled
_updateBufferPosition: function _updateBufferPosition() { _updateBufferPosition: function _updateBufferPosition() {
statusline.updateBufferPosition(); statusline.updateBufferPosition();
modes.show(); // Clear the status line. commandline.clear();
}, },
onDOMContentLoaded: function onDOMContentLoaded(event) { onDOMContentLoaded: function onDOMContentLoaded(event) {
@@ -273,7 +273,7 @@ const Buffer = Module("buffer", {
util.timeout(function () { util.timeout(function () {
statusline.updateBufferPosition(); statusline.updateBufferPosition();
statusline.updateZoomLevel(); statusline.updateZoomLevel();
modes.show(); // Clear the status line. commandline.clear();
}, 500); }, 500);
}, },
// called at the very end of a page load // called at the very end of a page load
@@ -295,7 +295,7 @@ const Buffer = Module("buffer", {
if (ssli == 1) if (ssli == 1)
statusline.updateUrl(); statusline.updateUrl();
else if (ssli == 2) else if (ssli == 2)
modes.show(); commandline.clear();
} }
}, },
}), }),

View File

@@ -404,6 +404,7 @@ const CommandLine = Module("commandline", {
win.focus(); win.focus();
this._startHints = false; this._startHints = false;
if (!(modes.extended & modes.OUTPUT_MULTILINE))
modes.set(modes.COMMAND_LINE, modes.OUTPUT_MULTILINE); modes.set(modes.COMMAND_LINE, modes.OUTPUT_MULTILINE);
commandline.updateMorePrompt(); commandline.updateMorePrompt();
}, },
@@ -567,6 +568,13 @@ const CommandLine = Module("commandline", {
return this._lastCommand = val; return this._lastCommand = val;
}, },
clear: function () {
if (this.widgets.message && this.widgets.message[1] === this._lastClearable)
this.widgets.message = null;
if (modes.main != modes.COMMAND_LINE)
this.widgets.command = null;
},
/** /**
* Displays the multi-line output of a command, preceded by the last * Displays the multi-line output of a command, preceded by the last
* executed ex command string. * executed ex command string.
@@ -638,21 +646,19 @@ const CommandLine = Module("commandline", {
if (this.widgets.message && this.widgets.message[1] == this._lastEcho) if (this.widgets.message && this.widgets.message[1] == this._lastEcho)
this._echoMultiline(<span highlight="Message">{this._lastEcho}</span>, this._echoMultiline(<span highlight="Message">{this._lastEcho}</span>,
this.widgets.message[0]); this.widgets.message[0]);
this._lastEcho = (action == this._echoLine) && str;
}
// TODO: this is all a bit convoluted - clean up.
// assume that FORCE_MULTILINE output is fully styled
if (!(flags & this.FORCE_MULTILINE) && !single
&& (!this.widgets.mowContainer.collapsed || this.widgets.message && this.widgets.message[1] == this._lastEcho)) {
if (!(flags & this.FORCE_MULTILINE) && !this.widgets.mowContainer.collapsed) {
highlightGroup += " Message"; highlightGroup += " Message";
action = this._echoMultiline; action = this._echoMultiline;
} }
this._lastEcho = (action == this._echoLine) && str;
}
if ((flags & this.FORCE_MULTILINE) || (/\n/.test(str) || typeof str == "xml") && !(flags & this.FORCE_SINGLELINE)) if ((flags & this.FORCE_MULTILINE) || (/\n/.test(str) || typeof str == "xml") && !(flags & this.FORCE_SINGLELINE))
action = this._echoMultiline; action = this._echoMultiline;
this._lastClearable = action === this._echoLine && String(str);
if (action) if (action)
action.call(this, str, highlightGroup, single); action.call(this, str, highlightGroup, single);
}), }),

View File

@@ -638,7 +638,7 @@ const Events = Module("events", {
else else
dactyl.echo("Waiting for page to load...", commandline.DISALLOW_MULTILINE); dactyl.echo("Waiting for page to load...", commandline.DISALLOW_MULTILINE);
} }
modes.show(); commandline.clear();
// TODO: allow macros to be continued when page does not fully load with an option // TODO: allow macros to be continued when page does not fully load with an option
let ret = (buffer.loaded == 1); let ret = (buffer.loaded == 1);