mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-03 05:54:13 +01:00
INPUT_MULTILINE ⊄ COMMAND_LINE.
--HG-- branch : key-processing
This commit is contained in:
@@ -42,7 +42,7 @@ var CommandWidgets = Class("CommandWidgets", {
|
|||||||
|
|
||||||
<vbox class="dactyl-container" hidden="false" collapsed="false" highlight="CmdLine">
|
<vbox class="dactyl-container" hidden="false" collapsed="false" highlight="CmdLine">
|
||||||
<textbox id="dactyl-multiline-input" class="plain" flex="1" rows="1" hidden="false" collapsed="true" multiline="true"
|
<textbox id="dactyl-multiline-input" class="plain" flex="1" rows="1" hidden="false" collapsed="true" multiline="true"
|
||||||
highlight="Normal Events" events="mowEvents" />
|
highlight="Normal Events" events="multilineInputEvents" />
|
||||||
</vbox>
|
</vbox>
|
||||||
</vbox>
|
</vbox>
|
||||||
|
|
||||||
@@ -569,9 +569,6 @@ var CommandLine = Module("commandline", {
|
|||||||
nodeSet.commandline.completionList.visible = false;
|
nodeSet.commandline.completionList.visible = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_multilineEnd: Modes.boundProperty(),
|
|
||||||
_multilineCallback: Modes.boundProperty(),
|
|
||||||
|
|
||||||
_lastClearable: Modes.boundProperty(),
|
_lastClearable: Modes.boundProperty(),
|
||||||
messages: Modes.boundProperty(),
|
messages: Modes.boundProperty(),
|
||||||
|
|
||||||
@@ -759,20 +756,21 @@ var CommandLine = Module("commandline", {
|
|||||||
* callback with that string as a parameter.
|
* callback with that string as a parameter.
|
||||||
*
|
*
|
||||||
* @param {string} end
|
* @param {string} end
|
||||||
* @param {function(string)} callbackFunc
|
* @param {function(string)} callback
|
||||||
*/
|
*/
|
||||||
// FIXME: Buggy, especially when pasting.
|
// FIXME: Buggy, especially when pasting.
|
||||||
inputMultiline: function inputMultiline(end, callbackFunc) {
|
inputMultiline: function inputMultiline(end, callback) {
|
||||||
let cmd = this.command;
|
let cmd = this.command;
|
||||||
modes.push(modes.COMMAND_LINE, modes.INPUT_MULTILINE, {
|
modes.push(modes.INPUT_MULTILINE, null, {
|
||||||
keyModes: [modes.INPUT_MULTILINE]
|
mappingSelf: {
|
||||||
|
end: "\n" + end + "\n",
|
||||||
|
callback: callback
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if (cmd != false)
|
if (cmd != false)
|
||||||
this._echoLine(cmd, this.HL_NORMAL);
|
this._echoLine(cmd, this.HL_NORMAL);
|
||||||
|
|
||||||
// save the arguments, they are needed in the event handler onKeyPress
|
// save the arguments, they are needed in the event handler onKeyPress
|
||||||
this._multilineEnd = "\n" + end + "\n";
|
|
||||||
this._multilineCallback = callbackFunc;
|
|
||||||
|
|
||||||
this.multilineInputVisible = true;
|
this.multilineInputVisible = true;
|
||||||
this.widgets.multilineInput.value = "";
|
this.widgets.multilineInput.value = "";
|
||||||
@@ -816,7 +814,7 @@ var CommandLine = Module("commandline", {
|
|||||||
*/
|
*/
|
||||||
multilineInputEvents: {
|
multilineInputEvents: {
|
||||||
blur: function onBlur(event) {
|
blur: function onBlur(event) {
|
||||||
if (modes.extended & modes.INPUT_MULTILINE)
|
if (modes.main == modes.INPUT_MULTILINE)
|
||||||
this.timeout(function () {
|
this.timeout(function () {
|
||||||
dactyl.focus(this.widgets.multilineInput.inputField);
|
dactyl.focus(this.widgets.multilineInput.inputField);
|
||||||
});
|
});
|
||||||
@@ -1355,6 +1353,11 @@ var CommandLine = Module("commandline", {
|
|||||||
bases: [modes.COMMAND_LINE],
|
bases: [modes.COMMAND_LINE],
|
||||||
input: true
|
input: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modes.addMode("INPUT_MULTILINE", {
|
||||||
|
bases: [modes.INSERT],
|
||||||
|
input: true
|
||||||
|
});
|
||||||
},
|
},
|
||||||
mappings: function init_mappings() {
|
mappings: function init_mappings() {
|
||||||
|
|
||||||
@@ -1364,18 +1367,17 @@ var CommandLine = Module("commandline", {
|
|||||||
|
|
||||||
mappings.add([modes.INPUT_MULTILINE],
|
mappings.add([modes.INPUT_MULTILINE],
|
||||||
["<Return>", "<C-j>", "<C-m>"], "Begin a new line",
|
["<Return>", "<C-j>", "<C-m>"], "Begin a new line",
|
||||||
function (args) {
|
function ({ self }) {
|
||||||
let text = "\n" + commandline.widgets.multilineInput
|
let text = "\n" + commandline.widgets.multilineInput
|
||||||
.value.substr(0, commandline.widgets.multilineInput.selectionStart)
|
.value.substr(0, commandline.widgets.multilineInput.selectionStart)
|
||||||
+ "\n";
|
+ "\n";
|
||||||
|
|
||||||
let index = text.indexOf(commandline._multilineEnd);
|
let index = text.indexOf(self.end);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
text = text.substring(1, index);
|
text = text.substring(1, index);
|
||||||
let callback = commandline._multilineCallback;
|
|
||||||
modes.pop();
|
modes.pop();
|
||||||
|
|
||||||
return function () callback.call(commandline, text);
|
return function () self.callback.call(commandline, text);
|
||||||
}
|
}
|
||||||
return Events.PASS;
|
return Events.PASS;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -154,11 +154,6 @@ var Modes = Module("modes", {
|
|||||||
input: true
|
input: true
|
||||||
});
|
});
|
||||||
|
|
||||||
this.addMode("INPUT_MULTILINE", {
|
|
||||||
extended: true,
|
|
||||||
hidden: true,
|
|
||||||
input: true
|
|
||||||
});
|
|
||||||
this.addMode("LINE", {
|
this.addMode("LINE", {
|
||||||
extended: true, hidden: true
|
extended: true, hidden: true
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user