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;
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);

View File

@@ -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

View File

@@ -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;

View File

@@ -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)