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

Add commandline.status and commandline.error. Feel free to revert this.

This commit is contained in:
Kris Maglione
2008-12-14 19:45:57 -05:00
parent bf895cc118
commit 58bca7d6b3
4 changed files with 35 additions and 19 deletions

View File

@@ -345,7 +345,7 @@ function Search() //{{{
found = fastFind.find(searchString, linksOnly) != Components.interfaces.nsITypeAheadFind.FIND_NOTFOUND; found = fastFind.find(searchString, linksOnly) != Components.interfaces.nsITypeAheadFind.FIND_NOTFOUND;
if (!found) 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; return found;
}, },
@@ -364,7 +364,7 @@ function Search() //{{{
if (result == Components.interfaces.nsITypeAheadFind.FIND_NOTFOUND) 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) else if (result == Components.interfaces.nsITypeAheadFind.FIND_WRAPPED)
{ {
@@ -381,7 +381,7 @@ function Search() //{{{
} }
else else
{ {
commandline.echo((up ? "?" : "/") + lastSearchPattern, null, commandline.FORCE_SINGLELINE); commandline.status = (up ? "?" : "/") + lastSearchPattern;
if (options["hlsearch"]) if (options["hlsearch"])
this.highlight(lastSearchString); this.highlight(lastSearchString);

View File

@@ -158,7 +158,7 @@ const modes = (function () //{{{
if (!options["showmode"]) if (!options["showmode"])
return; return;
commandline.echo(getModeMessage(), "ModeMsg", commandline.DISALLOW_MULTILINE); commandline.status = getModeMessage();
}, },
// add/remove always work on the extended mode only // add/remove always work on the extended mode only

View File

@@ -954,6 +954,30 @@ function CommandLine() //{{{
commandlineWidget.collapsed = true; 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 // 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) 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. // The DOM isn't threadsafe. It must only be accessed from the main thread.
liberator.callInMainThread(function () liberator.callInMainThread(function ()
{ {
let single = flags & (this.FORCE_SINGLELINE | this.DISALLOW_MULTILINE);
let action = echoLine; let action = echoLine;
if (!outputContainer.collapsed || messageBox.value == lastEcho) if (!outputContainer.collapsed || messageBox.value == lastEcho)
action = echoMultiline; 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) if ((flags & this.DISALLOW_MULTILINE) && !outputContainer.collapsed)
action = echoMultiline; return;
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 (single) if (single)
lastEcho = null; lastEcho = null;

View File

@@ -167,7 +167,7 @@ const util = { //{{{
clipboardHelper.copyString(str); clipboardHelper.copyString(str);
if (verbose) if (verbose)
liberator.echo("Yanked " + str, commandline.FORCE_SINGLELINE); commandline.status = "Yanked " + str;
}, },
createURI: function createURI(str) createURI: function createURI(str)