X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=common%2Fcontent%2Fcommandline.js;fp=common%2Fcontent%2Fcommandline.js;h=cae99423a67e83c50f1051ea9312bacb30305850;hb=70740024f9c028c1fd63e1a1850ab062ff956054;hp=69e6a3cc24e6118d23725b31754ef6ff5a350b8f;hpb=718c614c183350706466e22939d0101ca4c87efe;p=dactyl.git diff --git a/common/content/commandline.js b/common/content/commandline.js index 69e6a3c..cae9942 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -152,6 +152,7 @@ var CommandWidgets = Class("CommandWidgets", { return this.commandbar; } }); + this.updateVisibility(); }, addElement: function addElement(obj) { const self = this; @@ -174,7 +175,7 @@ var CommandWidgets = Class("CommandWidgets", { if (obj.value != null) return [obj.value[0], obj.get ? obj.get.call(this, elem) : elem.value] - .concat(obj.value.slice(2)) + .concat(obj.value.slice(2)); return null; }, @@ -300,19 +301,21 @@ var CommandWidgets = Class("CommandWidgets", { }); var CommandMode = Class("CommandMode", { - init: function init() { + init: function CM_init() { this.keepCommand = userContext.hidden_option_command_afterimage; }, + get autocomplete() options["autocomplete"].length, + get command() this.widgets.command[1], set command(val) this.widgets.command = val, get prompt() this.widgets.prompt, set prompt(val) this.widgets.prompt = val, - open: function (command) { + open: function CM_open(command) { dactyl.assert(isinstance(this.mode, modes.COMMAND_LINE), - "Not opening command line in non-command-line mode."); + /*L*/"Not opening command line in non-command-line mode."); this.messageCount = commandline.messageCount; modes.push(this.mode, this.extendedMode, this.closure); @@ -340,7 +343,7 @@ var CommandMode = Class("CommandMode", { get widgets() commandline.widgets, - enter: function (stack) { + enter: function CM_enter(stack) { commandline.commandSession = this; if (stack.pop && commandline.command) { this.onChange(commandline.command); @@ -349,7 +352,7 @@ var CommandMode = Class("CommandMode", { } }, - leave: function (stack) { + leave: function CM_leave(stack) { if (!stack.push) { commandline.commandSession = null; this.input.dactylKeyPress = undefined; @@ -374,7 +377,7 @@ var CommandMode = Class("CommandMode", { }, events: { - input: function onInput(event) { + input: function CM_onInput(event) { if (this.completions) { this.resetCompletions(); @@ -382,7 +385,7 @@ var CommandMode = Class("CommandMode", { } this.onChange(commandline.command); }, - keyup: function onKeyUp(event) { + keyup: function CM_onKeyUp(event) { let key = events.toString(event); if (/-?Tab>$/.test(key) && this.completions) this.completions.tabTimer.flush(); @@ -391,23 +394,22 @@ var CommandMode = Class("CommandMode", { keepCommand: false, - onKeyPress: function onKeyPress(events) { + onKeyPress: function CM_onKeyPress(events) { if (this.completions) this.completions.previewClear(); return true; /* Pass event */ }, - onCancel: function (value) { - }, + onCancel: function (value) {}, - onChange: function (value) { - }, + onChange: function (value) {}, - onSubmit: function (value) { - }, + onHistory: function (value) {}, + + onSubmit: function (value) {}, - resetCompletions: function resetCompletions() { + resetCompletions: function CM_resetCompletions() { if (this.completions) { this.completions.context.cancelAll(); this.completions.wildIndex = -1; @@ -426,12 +428,12 @@ var CommandExMode = Class("CommandExMode", CommandMode, { prompt: ["Normal", ":"], - complete: function complete(context) { + complete: function CEM_complete(context) { context.fork("ex", 0, completion, "ex"); }, - onSubmit: function onSubmit(command) { - contexts.withContext({ file: "[Command Line]", line: 1 }, + onSubmit: function CEM_onSubmit(command) { + contexts.withContext({ file: /*L*/"[Command Line]", line: 1 }, function _onSubmit() { io.withSavedValues(["readHeredoc"], function _onSubmit() { this.readHeredoc = commandline.readHeredoc; @@ -449,7 +451,7 @@ var CommandPromptMode = Class("CommandPromptMode", CommandMode, { init.supercall(this); }, - complete: function (context) { + complete: function CPM_complete(context) { if (this.completer) context.forkapply("prompt", 0, this, "completer", Array.slice(arguments, 1)); }, @@ -586,6 +588,9 @@ var CommandLine = Module("commandline", { get completionList() { let node = this.widgets.active.commandline; + if (this.commandSession && this.commandSession.completionList) + node = document.getElementById(this.commandSession.completionList); + if (!node.completionList) { let elem = document.getElementById("dactyl-completions-" + node.id); util.waitFor(bind(this.widgets._ready, null, elem)); @@ -648,11 +653,11 @@ var CommandLine = Module("commandline", { * @param {XML} xml The output as an E4X XML object. */ commandOutput: function commandOutput(xml) { - XML.ignoreWhitespace = false; - XML.prettyPrinting = false; + XML.ignoreWhitespace = XML.prettyPrinting = false; if (this.command) - this.echo(<>:{this.command}>, this.HIGHLIGHT_NORMAL, this.FORCE_MULTILINE); - this.echo(xml, this.HIGHLIGHT_NORMAL, this.FORCE_MULTILINE); + this.echo(<>