mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 07:37:59 +01:00
Fix some mode changing corner cases. Closes issue #51.
This commit is contained in:
@@ -423,14 +423,10 @@ const CommandLine = Module("commandline", {
|
|||||||
_keepCommand: Modes.boundProperty(),
|
_keepCommand: Modes.boundProperty(),
|
||||||
|
|
||||||
multilineInputVisible: Modes.boundProperty({
|
multilineInputVisible: Modes.boundProperty({
|
||||||
set: function (value) {
|
set: function (value) { this.widgets.multilineInput.collapsed = !value; }
|
||||||
this.widgets.multilineInput.collapsed = !value;
|
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
multilineOutputVisible: Modes.boundProperty({
|
multilineOutputVisible: Modes.boundProperty({
|
||||||
set: function (value) {
|
set: function (value) { this.widgets.mowContainer.collapsed = !value; }
|
||||||
this.widgets.mowContainer.collapsed = !value;
|
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -445,9 +441,7 @@ const CommandLine = Module("commandline", {
|
|||||||
*/
|
*/
|
||||||
open: function open(prompt, cmd, extendedMode) {
|
open: function open(prompt, cmd, extendedMode) {
|
||||||
modes.push(modes.COMMAND_LINE, this.currentExtendedMode, {
|
modes.push(modes.COMMAND_LINE, this.currentExtendedMode, {
|
||||||
leave: function (newMode) {
|
leave: commandline.closure.leave
|
||||||
commandline.leave(newMode);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.currentExtendedMode = extendedMode || null;
|
this.currentExtendedMode = extendedMode || null;
|
||||||
@@ -729,10 +723,9 @@ const CommandLine = Module("commandline", {
|
|||||||
* @param {string} end
|
* @param {string} end
|
||||||
* @param {function(string)} callbackFunc
|
* @param {function(string)} callbackFunc
|
||||||
*/
|
*/
|
||||||
// FIXME: Buggy, especially when pasting. Shouldn't use a RegExp.
|
// FIXME: Buggy, especially when pasting.
|
||||||
inputMultiline: function inputMultiline(end, callbackFunc) {
|
inputMultiline: function inputMultiline(end, callbackFunc) {
|
||||||
// Kludge.
|
let cmd = this.command;
|
||||||
let cmd = !this.widgets.active.command.collapsed && this.command;
|
|
||||||
modes.push(modes.COMMAND_LINE, modes.INPUT_MULTILINE);
|
modes.push(modes.COMMAND_LINE, modes.INPUT_MULTILINE);
|
||||||
if (cmd != false)
|
if (cmd != false)
|
||||||
this._echoLine(cmd, this.HL_NORMAL);
|
this._echoLine(cmd, this.HL_NORMAL);
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ const Dactyl = Module("dactyl", {
|
|||||||
* @param {number} frames The number of frames to print.
|
* @param {number} frames The number of frames to print.
|
||||||
*/
|
*/
|
||||||
dumpStack: function dumpStack(msg, frames) {
|
dumpStack: function dumpStack(msg, frames) {
|
||||||
let stack = Error().stack.replace(/(?:.*\n){2}/, "");
|
let stack = Error().stack.replace(/(?:.*\n){1}/, "");
|
||||||
if (frames != null)
|
if (frames != null)
|
||||||
[stack] = stack.match(RegExp("(?:.*\n){0," + frames + "}"));
|
[stack] = stack.match(RegExp("(?:.*\n){0," + frames + "}"));
|
||||||
dactyl.dump((msg || "Stack") + "\n" + stack + "\n");
|
dactyl.dump((msg || "Stack") + "\n" + stack + "\n");
|
||||||
|
|||||||
@@ -148,6 +148,9 @@ const Modes = Module("modes", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
save: function (id, obj, prop) {
|
save: function (id, obj, prop) {
|
||||||
|
if (!(id in this.boundProperties))
|
||||||
|
for (let elem in values(this._modeStack))
|
||||||
|
elem.saved[id] = { obj: obj, prop: prop, value: obj[prop] };
|
||||||
this.boundProperties[id] = { obj: Cu.getWeakReference(obj), prop: prop };
|
this.boundProperties[id] = { obj: Cu.getWeakReference(obj), prop: prop };
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -258,10 +261,10 @@ const Modes = Module("modes", {
|
|||||||
return val === undefined ? value : val;
|
return val === undefined ? value : val;
|
||||||
},
|
},
|
||||||
set: function (val) {
|
set: function (val) {
|
||||||
|
modes.save(id, this, prop)
|
||||||
if (desc.set)
|
if (desc.set)
|
||||||
value = desc.set.call(this, val);
|
value = desc.set.call(this, val);
|
||||||
value = !desc.set || value === undefined ? val : value;
|
value = !desc.set || value === undefined ? val : value;
|
||||||
modes.save(id, this, prop)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, desc));
|
}, desc));
|
||||||
|
|||||||
Reference in New Issue
Block a user