1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 08:47:59 +01:00

Push lines to the MOW where appropriate

This commit is contained in:
Kris Maglione
2008-12-07 11:33:56 -05:00
parent 7693ac5000
commit 0876a3bef2
2 changed files with 24 additions and 9 deletions

View File

@@ -1313,13 +1313,13 @@ const liberator = (function () //{{{
return true; return true;
}, },
callInMainThread: function (callback) callInMainThread: function (callback, self)
{ {
let mainThread = threadManager.mainThread; let mainThread = threadManager.mainThread;
if (!threadManager.isMainThread) if (!threadManager.isMainThread)
mainThread.dispatch({ run: callback }, mainThread.DISPATCH_NORMAL); mainThread.dispatch({ run: callback.call(self) }, mainThread.DISPATCH_NORMAL);
else else
callback(); callback.call(self);
}, },
threadYield: function (flush, interruptable) threadYield: function (flush, interruptable)

View File

@@ -71,6 +71,7 @@ function CommandLine() //{{{
var silent = false; var silent = false;
var keepCommand = false; var keepCommand = false;
var lastEcho = null;
function History(inputField, mode) function History(inputField, mode)
{ {
@@ -951,12 +952,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 action = outputContainer.collapsed ? echoLine : echoMultiline; let action = echoLine;
if (flags & commandline.FORCE_MULTILINE) if (!outputContainer.collapsed || messageBox.value == lastEcho)
action = echoMultiline; action = echoMultiline;
else if (flags & commandline.FORCE_SINGLELINE)
let single = flags & (this.FORCE_SINGLELINE | this.DISALLOW_MULTILINE);
if (flags & this.FORCE_MULTILINE)
action = echoMultiline;
else if (flags & this.FORCE_SINGLELINE)
action = echoLine; action = echoLine;
else if (flags & commandline.DISALLOW_MULTILINE) else if (flags & this.DISALLOW_MULTILINE)
{ {
if (!outputContainer.collapsed) if (!outputContainer.collapsed)
action = null; action = null;
@@ -966,9 +972,18 @@ function CommandLine() //{{{
else if (/\n/.test(str) || typeof str == "xml") else if (/\n/.test(str) || typeof str == "xml")
action = echoMultiline; action = echoMultiline;
if (single)
lastEcho = null;
else
{
if (messageBox.value == lastEcho)
echoMultiline(lastEcho);
lastEcho = (action == echoLine) && str;
}
if (action) if (action)
action(str, highlightGroup, (flags & (this.FORCE_SINGLELINE | this.DISALLOW_MULTILINE))); action(str, highlightGroup, single);
}); }, this);
return true; return true;
}, },