diff --git a/common/content/completion.js b/common/content/completion.js
index c2f2c0d0..11b7f407 100644
--- a/common/content/completion.js
+++ b/common/content/completion.js
@@ -1141,7 +1141,7 @@ function Completion() //{{{
context = context.contexts["/list"];
context.wait();
- let list = template.generic(
+ let list = template.commandOutput(
{ template.completionRow(context.title, "CompTitle") }
{ template.map(context.items, function (item) context.createRow(item), null, 100) }
diff --git a/common/content/events.js b/common/content/events.js
index 38449a05..7f0e47ab 100644
--- a/common/content/events.js
+++ b/common/content/events.js
@@ -207,7 +207,7 @@ function AutoCommands() //{{{
}
});
- var list = template.generic(
+ var list = template.commandOutput(
| ----- Auto Commands ----- |
diff --git a/common/content/hints.js b/common/content/hints.js
index 03c88bd3..fa39b97f 100644
--- a/common/content/hints.js
+++ b/common/content/hints.js
@@ -354,7 +354,7 @@ function Hints() //{{{
}
hintNumber = 0;
- hintString = commandline.getCommand();
+ hintString = commandline.command;
updateStatusline();
showHints();
if (validHints.length == 1)
diff --git a/common/content/io.js b/common/content/io.js
index 69f41f21..22156ffb 100644
--- a/common/content/io.js
+++ b/common/content/io.js
@@ -365,7 +365,7 @@ function IO() //{{{
let output = io.system(args);
- commandline.echo(template.generic({output}));
+ commandline.commandOutput(template.commandOutput({output}));
autocommands.trigger("ShellCmdPost", {});
},
diff --git a/common/content/liberator.js b/common/content/liberator.js
index 2861bf0c..d48ed17b 100644
--- a/common/content/liberator.js
+++ b/common/content/liberator.js
@@ -475,7 +475,7 @@ const liberator = (function () //{{{
totalUnits = "msec";
}
- var str = template.generic(
+ let str = template.commandOutput(
| Code execution summary |
@@ -528,7 +528,7 @@ const liberator = (function () //{{{
if (args.bang)
liberator.open("about:");
else
- liberator.echo(template.generic(<>{config.name} {liberator.version} running on:
{navigator.userAgent}>));
+ liberator.echo(template.commandOutput(<>{config.name} {liberator.version} running on:
{navigator.userAgent}>));
},
{
argCount: "0",
@@ -850,10 +850,10 @@ const liberator = (function () //{{{
err = "E477: No ! allowed";
}
- if (!err)
- command.execute(args, special, count, modifiers);
- else
- liberator.echoerr(err);
+ if (err)
+ return liberator.echoerr(err);
+ commandline.command = str.replace(/^\s*:\s*/);
+ command.execute(args, special, count, modifiers);
},
// TODO: move to buffer.focus()?
diff --git a/common/content/liberator.xul b/common/content/liberator.xul
index 3be74c0b..a2e67338 100644
--- a/common/content/liberator.xul
+++ b/common/content/liberator.xul
@@ -81,7 +81,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
-
+
:{commandline.getCommand()}
{xml}>;
+ return <>:{commandline.command}
{xml}>;
},
// every item must have a .xml property which defines how to draw itself
diff --git a/common/content/ui.js b/common/content/ui.js
index f6663812..c0b84460 100644
--- a/common/content/ui.js
+++ b/common/content/ui.js
@@ -168,7 +168,7 @@ function CommandLine() //{{{
get completion()
{
- let str = commandline.getCommand();
+ let str = commandline.command;
return str.substring(this.prefix.length, str.length - this.suffix.length);
},
set completion set_completion(completion)
@@ -373,7 +373,7 @@ function CommandLine() //{{{
if (this.substring && this.substring != this.completion)
{
this.completion = this.substring;
- liberator.triggerCallback("change", currentExtendedMode, commandline.getCommand());
+ liberator.triggerCallback("change", currentExtendedMode, commandline.command);
}
break;
}
@@ -412,7 +412,6 @@ function CommandLine() //{{{
});
var tabTimer = new util.Timer(0, 0, function tabTell(event) {
- liberator.dump("tabTell");
if (completions)
completions.tab(event.shiftKey);
});
@@ -456,7 +455,7 @@ function CommandLine() //{{{
let callback = promptSubmitCallback;
promptSubmitCallback = null;
if (callback)
- callback.call(commandline, value == null ? commandline.getCommand() : value);
+ callback.call(commandline, value == null ? commandline.command : value);
}
/////////////////////////////////////////////////////////////////////////////}}}
@@ -477,7 +476,6 @@ function CommandLine() //{{{
// the command bar which contains the current command
const commandWidget = document.getElementById("liberator-commandline-command");
-
const messageBox = document.getElementById("liberator-message");
commandWidget.inputField.QueryInterface(Components.interfaces.nsIDOMNSEditableElement);
@@ -496,6 +494,9 @@ function CommandLine() //{{{
// this is then used if we focus the command line again without the "official"
// way of calling "open"
var currentExtendedMode = null; // the extended mode which we last openend the command line for
+ // modules.__defineGetter__("currentExtendedMode", function () _currentExtendedMode)
+ // modules.__defineSetter__("currentExtendedMode", function (val) (liberator.dumpStack("currentExtendedMode = " + (val && modes.getMode(val).name)),
+ // _currentExtendedMode = val))
var currentPrompt = null;
var currentCommand = null;
@@ -541,8 +542,6 @@ function CommandLine() //{{{
let field = messageBox.inputField;
if (!forceSingle && field.editor.rootElement.scrollWidth > field.scrollWidth)
echoMultiline({str}, highlightGroup);
- else
- messageBox.collapsed = false;
}
// TODO: resize upon a window resize
@@ -871,7 +870,7 @@ function CommandLine() //{{{
storage.styles.removeSheet("silent-mode", null, null, null, true);
},
- getCommand: function getCommand()
+ get command()
{
try
{
@@ -880,6 +879,7 @@ function CommandLine() //{{{
catch (e) {}
return commandWidget.value;
},
+ set command(cmd) commandWidget.value = cmd,
open: function open(prompt, cmd, extendedMode)
{
@@ -890,12 +890,12 @@ function CommandLine() //{{{
currentExtendedMode = extendedMode || null;
keepCommand = false;
- modes.set(modes.COMMAND_LINE, currentExtendedMode);
-
setPrompt(currentPrompt);
setCommand(currentCommand);
commandlineWidget.collapsed = false;
+ modes.set(modes.COMMAND_LINE, currentExtendedMode);
+
commandWidget.focus();
history = History(commandWidget.inputField, (modes.extended == modes.EX) ? "command" : "search");
@@ -940,13 +940,8 @@ function CommandLine() //{{{
// 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)
{
- let focused = document.commandDispatcher.focusedElement;
- if (focused && focused == commandWidget.inputField || focused == multilineInputWidget.inputField)
- return false;
if (silent)
return false;
- if (modes.main == modes.COMMAND_LINE)
- return false;
highlightGroup = highlightGroup || this.HL_NORMAL;
@@ -956,7 +951,7 @@ function CommandLine() //{{{
// The DOM isn't threadsafe. It must only be accessed from the main thread.
liberator.callInMainThread(function ()
{
- let action = echoLine;
+ let action = outputContainer.collapsed ? echoLine : echoMultiline;
if (flags & commandline.FORCE_MULTILINE)
action = echoMultiline;
else if (flags & commandline.FORCE_SINGLELINE)
@@ -973,9 +968,6 @@ function CommandLine() //{{{
if (action)
action(str, highlightGroup, (flags & (this.FORCE_SINGLELINE | this.DISALLOW_MULTILINE)));
-
- // Why do we do this? --Kris
- currentExtendedMode = null;
});
return true;
@@ -1022,7 +1014,7 @@ function CommandLine() //{{{
onEvent: function onEvent(event)
{
- let command = this.getCommand();
+ let command = this.command;
if (event.type == "blur")
{
@@ -1034,7 +1026,7 @@ function CommandLine() //{{{
}
else if (event.type == "focus")
{
- if (!currentExtendedMode && event.target == commandWidget.inputField)
+ if (!commandShown() && event.target == commandWidget.inputField)
{
event.target.blur();
liberator.beep();