diff --git a/common/content/find.js b/common/content/find.js index 02468f5f..1e31c3b3 100644 --- a/common/content/find.js +++ b/common/content/find.js @@ -345,7 +345,7 @@ function Search() //{{{ found = fastFind.find(searchString, linksOnly) != Components.interfaces.nsITypeAheadFind.FIND_NOTFOUND; if (!found) - setTimeout(function () liberator.echoerr("E486: Pattern not found: " + searchPattern, commandline.FORCE_SINGLELINE), 0); + setTimeout(function () commandline.error = "E486: Pattern not found: " + searchPattern, 0); return found; }, @@ -364,7 +364,7 @@ function Search() //{{{ if (result == Components.interfaces.nsITypeAheadFind.FIND_NOTFOUND) { - liberator.echoerr("E486: Pattern not found: " + lastSearchPattern, commandline.FORCE_SINGLELINE); + commandline.error = "E486: Pattern not found: " + lastSearchPattern; } else if (result == Components.interfaces.nsITypeAheadFind.FIND_WRAPPED) { @@ -381,7 +381,7 @@ function Search() //{{{ } else { - commandline.echo((up ? "?" : "/") + lastSearchPattern, null, commandline.FORCE_SINGLELINE); + commandline.status = (up ? "?" : "/") + lastSearchPattern; if (options["hlsearch"]) this.highlight(lastSearchString); diff --git a/common/content/modes.js b/common/content/modes.js index 203d6198..b9abfaeb 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -158,7 +158,7 @@ const modes = (function () //{{{ if (!options["showmode"]) return; - commandline.echo(getModeMessage(), "ModeMsg", commandline.DISALLOW_MULTILINE); + commandline.status = getModeMessage(); }, // add/remove always work on the extended mode only diff --git a/common/content/ui.js b/common/content/ui.js index 1c000ade..cdb93b51 100644 --- a/common/content/ui.js +++ b/common/content/ui.js @@ -954,6 +954,30 @@ function CommandLine() //{{{ commandlineWidget.collapsed = true; }, + get error() + { + if (lastEcho != messageBox.value && messageBox.getAttributeNS(NS.uri, "highlight") == this.HL_ERRORMSG) + return messageBox.value; + return null; + }, + set error(status) + { + lastEcho = null; + echoLine(status, this.HL_ERRORMSG, true); + }, + + get status() + { + if (lastEcho != messageBox.value && messageBox.getAttributeNS(NS.uri, "highlight") == this.HL_NORMAL) + return messageBox.value; + return null; + }, + set status(status) + { + lastEcho = null; + echoLine(status, this.HL_NORMAL, true); + }, + // liberator.echo uses different order of flags as it omits the hightlight group, change v.commandline.echo argument order? --mst echo: function echo(str, highlightGroup, flags) { @@ -968,25 +992,17 @@ function CommandLine() //{{{ // The DOM isn't threadsafe. It must only be accessed from the main thread. liberator.callInMainThread(function () { + let single = flags & (this.FORCE_SINGLELINE | this.DISALLOW_MULTILINE); + let action = echoLine; if (!outputContainer.collapsed || messageBox.value == lastEcho) action = echoMultiline; - let single = flags & (this.FORCE_SINGLELINE | this.DISALLOW_MULTILINE); + if ((flags & this.FORCE_MULTILINE) || (/\n/.test(str) || typeof str == "xml") && !(flags & this.FORCE_SINGLELINE)) + action = echoMultiline; - if (flags & this.FORCE_MULTILINE) - action = echoMultiline; - else if (flags & this.FORCE_SINGLELINE) - action = echoLine; - else if (flags & this.DISALLOW_MULTILINE) - { - if (!outputContainer.collapsed) - action = null; - else - action = echoLine; - } - else if (/\n/.test(str) || typeof str == "xml") - action = echoMultiline; + if ((flags & this.DISALLOW_MULTILINE) && !outputContainer.collapsed) + return; if (single) lastEcho = null; diff --git a/common/content/util.js b/common/content/util.js index 098c94f3..05bbd6d8 100644 --- a/common/content/util.js +++ b/common/content/util.js @@ -167,7 +167,7 @@ const util = { //{{{ clipboardHelper.copyString(str); if (verbose) - liberator.echo("Yanked " + str, commandline.FORCE_SINGLELINE); + commandline.status = "Yanked " + str; }, createURI: function createURI(str)