mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-24 03:12:27 +01:00
Experimental don't-dump-extra-messages-into-the-MOW support.
This commit is contained in:
@@ -30,9 +30,11 @@ var CommandWidgets = Class("CommandWidgets", {
|
|||||||
id: "dactyl-container", highlight: "CmdLine CmdCmdLine" },
|
id: "dactyl-container", highlight: "CmdLine CmdCmdLine" },
|
||||||
["textbox", { class: "plain", id: "dactyl-strut", flex: "1", crop: "end", collapsed: "true" }],
|
["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-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" }],
|
["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",
|
["textbox", { id: "dactyl-commandline-command", class: "dactyl-commandline-command plain", flex: "1", type: "input", timeout: "100",
|
||||||
highlight: "Events" }]]],
|
highlight: "Events" }]]],
|
||||||
@@ -124,12 +126,26 @@ var CommandWidgets = Class("CommandWidgets", {
|
|||||||
return this.statusbar;
|
return this.statusbar;
|
||||||
|
|
||||||
let statusElem = this.statusbar.message;
|
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.commandbar;
|
||||||
return this.activeGroup.mode;
|
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({
|
this.addElement({
|
||||||
name: "mode",
|
name: "mode",
|
||||||
defaultGroup: "ModeMsg",
|
defaultGroup: "ModeMsg",
|
||||||
@@ -651,6 +667,7 @@ var CommandLine = Module("commandline", {
|
|||||||
if (!scroll || Date.now() - this._lastEchoTime > 5000)
|
if (!scroll || Date.now() - this._lastEchoTime > 5000)
|
||||||
this.clearMessage();
|
this.clearMessage();
|
||||||
this._lastEchoTime = 0;
|
this._lastEchoTime = 0;
|
||||||
|
this.hiddenMessages = 0;
|
||||||
|
|
||||||
if (!this.commandSession) {
|
if (!this.commandSession) {
|
||||||
this.widgets.command = null;
|
this.widgets.command = null;
|
||||||
@@ -665,8 +682,10 @@ var CommandLine = Module("commandline", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
clearMessage: function clearMessage() {
|
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.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,
|
_lastEcho: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -748,15 +777,19 @@ var CommandLine = Module("commandline", {
|
|||||||
|
|
||||||
highlightGroup = highlightGroup || this.HL_NORMAL;
|
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 };
|
let message = isObject(data) && !DOM.isJSONXML(data) ? data : { message: data };
|
||||||
|
|
||||||
// Make sure the memoized message property is an instance property.
|
// Make sure the memoized message property is an instance property.
|
||||||
message.message;
|
message.message;
|
||||||
this._messageHistory.add(update({ highlight: highlightGroup }, message));
|
self._messageHistory.add(update({ highlight: highlightGroup }, message));
|
||||||
data = message.message;
|
data = message.message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (flags & this.APPEND_TO_MESSAGES)
|
||||||
|
appendToMessages();
|
||||||
|
|
||||||
if ((flags & this.ACTIVE_WINDOW) && window != overlay.activeWindow)
|
if ((flags & this.ACTIVE_WINDOW) && window != overlay.activeWindow)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -769,17 +802,16 @@ var CommandLine = Module("commandline", {
|
|||||||
if ((flags & this.FORCE_MULTILINE) || (/\n/.test(data) || !isinstance(data, [_, "String"])) && !(flags & this.FORCE_SINGLELINE))
|
if ((flags & this.FORCE_MULTILINE) || (/\n/.test(data) || !isinstance(data, [_, "String"])) && !(flags & this.FORCE_SINGLELINE))
|
||||||
action = mow.closure.echo;
|
action = mow.closure.echo;
|
||||||
|
|
||||||
if (single)
|
if (single) {
|
||||||
this._lastEcho = null;
|
this._lastEcho = null;
|
||||||
|
this.hiddenMessages = 0;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if (this.widgets.message && this.widgets.message[1] == this._lastEcho)
|
if (this.widgets.message && this.widgets.message[1] == this._lastEcho) {
|
||||||
mow.echo(["span", { highlight: "Message" }, this._lastEcho],
|
if (!(flags & this.APPEND_TO_MESSAGES))
|
||||||
this.widgets.message[0], true);
|
appendToMessages();
|
||||||
|
this.hiddenMessages++;
|
||||||
if (action === this._echoLine && !(flags & this.FORCE_MULTILINE)
|
return;
|
||||||
&& !(dactyl.fullyInitialized && this.widgets.mowContainer.collapsed)) {
|
|
||||||
highlightGroup += " Message";
|
|
||||||
action = mow.closure.echo;
|
|
||||||
}
|
}
|
||||||
this._lastEcho = (action == this._echoLine) && data;
|
this._lastEcho = (action == this._echoLine) && data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,8 +63,10 @@ var StatusLine = Module("statusline", {
|
|||||||
["stack", { id: "dactyl-statusline-stack", flex: "1", highlight: "CmdLine StatusCmdLine", class: "dactyl-container" },
|
["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",
|
["textbox", { key: "url", crop: "end", flex: "1", style: "background: transparent;", class: "plain dactyl-status-field-url",
|
||||||
readonly: "true" }],
|
readonly: "true" }],
|
||||||
["textbox", { key: "message", crop: "end", flex: "1", highlight: "Normal StatusNormal", class: "plain",
|
["hbox", { key: "message-box" },
|
||||||
readonly: "true" }]]]],
|
["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: "inputbuffer", flex: "0" }],
|
||||||
["label", { class: "plain", key: "progress", flex: "0" }],
|
["label", { class: "plain", key: "progress", flex: "0" }],
|
||||||
["label", { class: "plain", key: "tabcount", flex: "0" }],
|
["label", { class: "plain", key: "tabcount", flex: "0" }],
|
||||||
|
|||||||
@@ -122,6 +122,8 @@ command.set.unknownOption-1 = E518: Unknown option: %S
|
|||||||
command.yank.yankedLine-1 = Yanked %S line
|
command.yank.yankedLine-1 = Yanked %S line
|
||||||
command.yank.yankedLines-1 = Yanked %S lines
|
command.yank.yankedLines-1 = Yanked %S lines
|
||||||
|
|
||||||
|
commandline.moreMessages = [%S more. Type :messages to read]
|
||||||
|
|
||||||
completion.additional = (additional)
|
completion.additional = (additional)
|
||||||
completion.generating = Generating results...
|
completion.generating = Generating results...
|
||||||
completion.noCompletions = No Completions
|
completion.noCompletions = No Completions
|
||||||
|
|||||||
Reference in New Issue
Block a user