diff options
author | Kris Maglione <maglione.k@gmail.com> | 2013-03-04 20:37:12 -0800 |
---|---|---|
committer | Kris Maglione <maglione.k@gmail.com> | 2013-03-04 20:37:12 -0800 |
commit | f831e4997fd7c0d1e893e57d86d8145ca3985b9e (patch) | |
tree | 3f4daf07e2df5f178cc389f3be96f1821e0b6c5d /common | |
parent | 24e4ae8e3d4884fd34122a585e15b315d268fa97 (diff) | |
download | pentadactyl-f831e4997fd7c0d1e893e57d86d8145ca3985b9e.tar.gz |
Experimental don't-dump-extra-messages-into-the-MOW support.
Diffstat (limited to 'common')
-rw-r--r-- | common/content/commandline.js | 62 | ||||
-rw-r--r-- | common/content/statusline.js | 6 | ||||
-rw-r--r-- | common/locale/en-US/messages.properties | 2 |
3 files changed, 53 insertions, 17 deletions
diff --git a/common/content/commandline.js b/common/content/commandline.js index 0a38d267..d0451fe9 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -30,9 +30,11 @@ var CommandWidgets = Class("CommandWidgets", { id: "dactyl-container", highlight: "CmdLine CmdCmdLine" }, ["textbox", { class: "plain", id: "dactyl-strut", flex: "1", crop: "end", collapsed: "true" }], ["textbox", { class: "plain", id: "dactyl-mode", flex: "1", crop: "end" }], - ["textbox", { class: "plain", id: "dactyl-message", flex: "1", readonly: "true" }], + ["hbox", { id: "dactyl-message-box" }, + ["label", { class: "plain", id: "dactyl-message-pre", flex: "0", readonly: "true", highlight: "WarningMsg" }], + ["textbox", { class: "plain", id: "dactyl-message", flex: "1", readonly: "true" }]], - ["hbox", { id: "dactyl-commandline", hidden: "false", foo: "bar", class: "dactyl-container", highlight: "Normal CmdNormal", collapsed: "true" }, + ["hbox", { id: "dactyl-commandline", hidden: "false", class: "dactyl-container", highlight: "Normal CmdNormal", collapsed: "true" }, ["label", { id: "dactyl-commandline-prompt", class: "dactyl-commandline-prompt plain", flex: "0", crop: "end", value: "", collapsed: "true" }], ["textbox", { id: "dactyl-commandline-command", class: "dactyl-commandline-command plain", flex: "1", type: "input", timeout: "100", highlight: "Events" }]]], @@ -124,13 +126,27 @@ var CommandWidgets = Class("CommandWidgets", { return this.statusbar; let statusElem = this.statusbar.message; - if (value && !value[2] && statusElem.editor && statusElem.editor.rootElement.scrollWidth > statusElem.scrollWidth) + // Currently doesn't work as expected with <hbox> parent. + if (false && value && !value[2] && statusElem.editor && statusElem.editor.rootElement.scrollWidth > statusElem.scrollWidth) return this.commandbar; return this.activeGroup.mode; } }); this.addElement({ + name: "message-pre", + defaultGroup: "WarningMsg", + getGroup: function () this.activeGroup.message + }); + + this.addElement({ + name: "message-box", + defaultGroup: "Normal", + getGroup: function () this.activeGroup.message, + getValue: function () this.message + }); + + this.addElement({ name: "mode", defaultGroup: "ModeMsg", getGroup: function (value) { @@ -651,6 +667,7 @@ var CommandLine = Module("commandline", { if (!scroll || Date.now() - this._lastEchoTime > 5000) this.clearMessage(); this._lastEchoTime = 0; + this.hiddenMessages = 0; if (!this.commandSession) { this.widgets.command = null; @@ -665,8 +682,10 @@ var CommandLine = Module("commandline", { }, clearMessage: function clearMessage() { - if (this.widgets.message && this.widgets.message[1] === this._lastClearable) + if (this.widgets.message && this.widgets.message[1] === this._lastClearable) { this.widgets.message = null; + this.hiddenMessages = 0; + } }, /** @@ -715,6 +734,16 @@ var CommandLine = Module("commandline", { } }, + _hiddenMessages: 0, + get hiddenMessages() this._hiddenMessages, + set hiddenMessages(val) { + this._hiddenMessages = val; + if (val) + this.widgets["message-pre"] = _("commandline.moreMessages", val) + " "; + else + this.widgets["message-pre"] = null + }, + _lastEcho: null, /** @@ -748,15 +777,19 @@ var CommandLine = Module("commandline", { highlightGroup = highlightGroup || this.HL_NORMAL; - if (flags & this.APPEND_TO_MESSAGES) { + let self = this; + function appendToMessages() { let message = isObject(data) && !DOM.isJSONXML(data) ? data : { message: data }; // Make sure the memoized message property is an instance property. message.message; - this._messageHistory.add(update({ highlight: highlightGroup }, message)); + self._messageHistory.add(update({ highlight: highlightGroup }, message)); data = message.message; } + if (flags & this.APPEND_TO_MESSAGES) + appendToMessages(); + if ((flags & this.ACTIVE_WINDOW) && window != overlay.activeWindow) return; @@ -769,17 +802,16 @@ var CommandLine = Module("commandline", { if ((flags & this.FORCE_MULTILINE) || (/\n/.test(data) || !isinstance(data, [_, "String"])) && !(flags & this.FORCE_SINGLELINE)) action = mow.closure.echo; - if (single) + if (single) { this._lastEcho = null; + this.hiddenMessages = 0; + } else { - if (this.widgets.message && this.widgets.message[1] == this._lastEcho) - mow.echo(["span", { highlight: "Message" }, this._lastEcho], - this.widgets.message[0], true); - - if (action === this._echoLine && !(flags & this.FORCE_MULTILINE) - && !(dactyl.fullyInitialized && this.widgets.mowContainer.collapsed)) { - highlightGroup += " Message"; - action = mow.closure.echo; + if (this.widgets.message && this.widgets.message[1] == this._lastEcho) { + if (!(flags & this.APPEND_TO_MESSAGES)) + appendToMessages(); + this.hiddenMessages++; + return; } this._lastEcho = (action == this._echoLine) && data; } diff --git a/common/content/statusline.js b/common/content/statusline.js index 05a817b6..c00a0399 100644 --- a/common/content/statusline.js +++ b/common/content/statusline.js @@ -63,8 +63,10 @@ var StatusLine = Module("statusline", { ["stack", { id: "dactyl-statusline-stack", flex: "1", highlight: "CmdLine StatusCmdLine", class: "dactyl-container" }, ["textbox", { key: "url", crop: "end", flex: "1", style: "background: transparent;", class: "plain dactyl-status-field-url", readonly: "true" }], - ["textbox", { key: "message", crop: "end", flex: "1", highlight: "Normal StatusNormal", class: "plain", - readonly: "true" }]]]], + ["hbox", { key: "message-box" }, + ["label", { key: "message-pre", highlight: "WarningMsg StatusWarningMsg", class: "plain", readonly: "true" }], + ["textbox", { key: "message", crop: "end", flex: "1", highlight: "Normal StatusNormal", class: "plain", + readonly: "true" }]]]]], ["label", { class: "plain", key: "inputbuffer", flex: "0" }], ["label", { class: "plain", key: "progress", flex: "0" }], ["label", { class: "plain", key: "tabcount", flex: "0" }], diff --git a/common/locale/en-US/messages.properties b/common/locale/en-US/messages.properties index 62659346..b7a6211d 100644 --- a/common/locale/en-US/messages.properties +++ b/common/locale/en-US/messages.properties @@ -122,6 +122,8 @@ command.set.unknownOption-1 = E518: Unknown option: %S command.yank.yankedLine-1 = Yanked %S line command.yank.yankedLines-1 = Yanked %S lines +commandline.moreMessages = [%S more. Type :messages to read] + completion.additional = (additional) completion.generating = Generating results... completion.noCompletions = No Completions |