mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-07 05:35:46 +01:00
Fix :time :stuff, etc.
This commit is contained in:
@@ -1141,7 +1141,7 @@ function Completion() //{{{
|
||||
context = context.contexts["/list"];
|
||||
context.wait();
|
||||
|
||||
let list = template.generic(
|
||||
let list = template.commandOutput(
|
||||
<div highlight="Completions">
|
||||
{ template.completionRow(context.title, "CompTitle") }
|
||||
{ template.map(context.items, function (item) context.createRow(item), null, 100) }
|
||||
|
||||
@@ -207,7 +207,7 @@ function AutoCommands() //{{{
|
||||
}
|
||||
});
|
||||
|
||||
var list = template.generic(
|
||||
var list = template.commandOutput(
|
||||
<table>
|
||||
<tr highlight="Title">
|
||||
<td colspan="2">----- Auto Commands -----</td>
|
||||
|
||||
@@ -354,7 +354,7 @@ function Hints() //{{{
|
||||
}
|
||||
|
||||
hintNumber = 0;
|
||||
hintString = commandline.getCommand();
|
||||
hintString = commandline.command;
|
||||
updateStatusline();
|
||||
showHints();
|
||||
if (validHints.length == 1)
|
||||
|
||||
@@ -365,7 +365,7 @@ function IO() //{{{
|
||||
|
||||
let output = io.system(args);
|
||||
|
||||
commandline.echo(template.generic(<span highlight="CmdOutput">{output}</span>));
|
||||
commandline.commandOutput(template.commandOutput(<span highlight="CmdOutput">{output}</span>));
|
||||
|
||||
autocommands.trigger("ShellCmdPost", {});
|
||||
},
|
||||
|
||||
@@ -475,7 +475,7 @@ const liberator = (function () //{{{
|
||||
totalUnits = "msec";
|
||||
}
|
||||
|
||||
var str = template.generic(
|
||||
let str = template.commandOutput(
|
||||
<table>
|
||||
<tr highlight="Title" align="left">
|
||||
<th colspan="3">Code execution summary</th>
|
||||
@@ -528,7 +528,7 @@ const liberator = (function () //{{{
|
||||
if (args.bang)
|
||||
liberator.open("about:");
|
||||
else
|
||||
liberator.echo(template.generic(<>{config.name} {liberator.version} running on:<br/>{navigator.userAgent}</>));
|
||||
liberator.echo(template.commandOutput(<>{config.name} {liberator.version} running on:<br/>{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()?
|
||||
|
||||
@@ -81,7 +81,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
||||
|
||||
<stack orient="horizontal" align="stretch" class="liberator-container" liberator:highlight="CmdLine">
|
||||
<textbox class="plain" id="liberator-message" flex="1" readonly="true" liberator:highlight="Normal"/>
|
||||
<hbox id="liberator-commandline" hidden="false" class="liberator-container" liberator:highlight="Normal">
|
||||
<hbox id="liberator-commandline" hidden="false" collapsed="true" class="liberator-container" liberator:highlight="Normal">
|
||||
<label class="plain" id="liberator-commandline-prompt" flex="0" crop="end" value="" collapsed="true"/>
|
||||
<textbox class="plain" id="liberator-commandline-command" flex="1" type="timed" timeout="100"
|
||||
oninput="liberator.modules.commandline.onEvent(event);"
|
||||
|
||||
@@ -159,7 +159,7 @@ const modes = (function () //{{{
|
||||
if (!options["showmode"])
|
||||
return;
|
||||
|
||||
commandline.echo(getModeMessage(), "ModeMsg");
|
||||
commandline.echo(getModeMessage(), "ModeMsg", commandline.DISALLOW_MULTILINE);
|
||||
},
|
||||
|
||||
// add/remove always work on the extended mode only
|
||||
@@ -226,8 +226,11 @@ const modes = (function () //{{{
|
||||
|
||||
remove: function (mode)
|
||||
{
|
||||
extended &= ~mode;
|
||||
this.show();
|
||||
if (extended & mode)
|
||||
{
|
||||
extended &= ~mode;
|
||||
this.show();
|
||||
}
|
||||
},
|
||||
|
||||
get passNextKey() passNextKey,
|
||||
|
||||
@@ -204,9 +204,9 @@ const template = {
|
||||
return str;
|
||||
},
|
||||
|
||||
generic: function generic(xml)
|
||||
commandOutput: function generic(xml)
|
||||
{
|
||||
return <>:{commandline.getCommand()}<br/>{xml}</>;
|
||||
return <>:{commandline.command}<br/>{xml}</>;
|
||||
},
|
||||
|
||||
// every item must have a .xml property which defines how to draw itself
|
||||
|
||||
@@ -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(<span highlight="Message">{str}</span>, 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();
|
||||
|
||||
Reference in New Issue
Block a user