diff --git a/common/content/browser.js b/common/content/browser.js index 403199a8..292c0c53 100644 --- a/common/content/browser.js +++ b/common/content/browser.js @@ -188,9 +188,7 @@ const Browser = Module("browser", { function () { window.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIDOMWindowUtils).redraw(); - commandline.widgets.message = null; - if (modes.main != modes.COMMAND_LINE) - commandline.widgets.command = null; + commandline.clear(); }, { argCount: "0" }); } diff --git a/common/content/buffer.js b/common/content/buffer.js index 3e645678..ca8c175d 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -161,7 +161,7 @@ const Buffer = Module("buffer", { // called when the active document is scrolled _updateBufferPosition: function _updateBufferPosition() { statusline.updateBufferPosition(); - modes.show(); // Clear the status line. + commandline.clear(); }, onDOMContentLoaded: function onDOMContentLoaded(event) { @@ -273,7 +273,7 @@ const Buffer = Module("buffer", { util.timeout(function () { statusline.updateBufferPosition(); statusline.updateZoomLevel(); - modes.show(); // Clear the status line. + commandline.clear(); }, 500); }, // called at the very end of a page load @@ -295,7 +295,7 @@ const Buffer = Module("buffer", { if (ssli == 1) statusline.updateUrl(); else if (ssli == 2) - modes.show(); + commandline.clear(); } }, }), diff --git a/common/content/commandline.js b/common/content/commandline.js index 54ff49f2..4b82a469 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -404,7 +404,8 @@ const CommandLine = Module("commandline", { win.focus(); this._startHints = false; - modes.set(modes.COMMAND_LINE, modes.OUTPUT_MULTILINE); + if (!(modes.extended & modes.OUTPUT_MULTILINE)) + modes.set(modes.COMMAND_LINE, modes.OUTPUT_MULTILINE); commandline.updateMorePrompt(); }, @@ -567,6 +568,13 @@ const CommandLine = Module("commandline", { 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 * executed ex command string. @@ -638,21 +646,19 @@ const CommandLine = Module("commandline", { if (this.widgets.message && this.widgets.message[1] == this._lastEcho) this._echoMultiline({this._lastEcho}, this.widgets.message[0]); + + if (!(flags & this.FORCE_MULTILINE) && !this.widgets.mowContainer.collapsed) { + highlightGroup += " Message"; + action = this._echoMultiline; + } 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)) { - - highlightGroup += " Message"; - action = this._echoMultiline; - } - if ((flags & this.FORCE_MULTILINE) || (/\n/.test(str) || typeof str == "xml") && !(flags & this.FORCE_SINGLELINE)) action = this._echoMultiline; + this._lastClearable = action === this._echoLine && String(str); + if (action) action.call(this, str, highlightGroup, single); }), diff --git a/common/content/events.js b/common/content/events.js index a1f4a594..d4ae92fa 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -638,7 +638,7 @@ const Events = Module("events", { else 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 let ret = (buffer.loaded == 1);