mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 10:37:58 +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(),
|
||||
|
||||
multilineInputVisible: Modes.boundProperty({
|
||||
set: function (value) {
|
||||
this.widgets.multilineInput.collapsed = !value;
|
||||
}
|
||||
set: function (value) { this.widgets.multilineInput.collapsed = !value; }
|
||||
}),
|
||||
multilineOutputVisible: Modes.boundProperty({
|
||||
set: function (value) {
|
||||
this.widgets.mowContainer.collapsed = !value;
|
||||
}
|
||||
set: function (value) { this.widgets.mowContainer.collapsed = !value; }
|
||||
}),
|
||||
|
||||
/**
|
||||
@@ -445,9 +441,7 @@ const CommandLine = Module("commandline", {
|
||||
*/
|
||||
open: function open(prompt, cmd, extendedMode) {
|
||||
modes.push(modes.COMMAND_LINE, this.currentExtendedMode, {
|
||||
leave: function (newMode) {
|
||||
commandline.leave(newMode);
|
||||
}
|
||||
leave: commandline.closure.leave
|
||||
});
|
||||
|
||||
this.currentExtendedMode = extendedMode || null;
|
||||
@@ -729,10 +723,9 @@ const CommandLine = Module("commandline", {
|
||||
* @param {string} end
|
||||
* @param {function(string)} callbackFunc
|
||||
*/
|
||||
// FIXME: Buggy, especially when pasting. Shouldn't use a RegExp.
|
||||
// FIXME: Buggy, especially when pasting.
|
||||
inputMultiline: function inputMultiline(end, callbackFunc) {
|
||||
// Kludge.
|
||||
let cmd = !this.widgets.active.command.collapsed && this.command;
|
||||
let cmd = this.command;
|
||||
modes.push(modes.COMMAND_LINE, modes.INPUT_MULTILINE);
|
||||
if (cmd != false)
|
||||
this._echoLine(cmd, this.HL_NORMAL);
|
||||
|
||||
@@ -237,7 +237,7 @@ const Dactyl = Module("dactyl", {
|
||||
* @param {number} frames The number of frames to print.
|
||||
*/
|
||||
dumpStack: function dumpStack(msg, frames) {
|
||||
let stack = Error().stack.replace(/(?:.*\n){2}/, "");
|
||||
let stack = Error().stack.replace(/(?:.*\n){1}/, "");
|
||||
if (frames != null)
|
||||
[stack] = stack.match(RegExp("(?:.*\n){0," + frames + "}"));
|
||||
dactyl.dump((msg || "Stack") + "\n" + stack + "\n");
|
||||
|
||||
@@ -148,6 +148,9 @@ const Modes = Module("modes", {
|
||||
},
|
||||
|
||||
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 };
|
||||
},
|
||||
|
||||
@@ -258,10 +261,10 @@ const Modes = Module("modes", {
|
||||
return val === undefined ? value : val;
|
||||
},
|
||||
set: function (val) {
|
||||
modes.save(id, this, prop)
|
||||
if (desc.set)
|
||||
value = desc.set.call(this, val);
|
||||
value = !desc.set || value === undefined ? val : value;
|
||||
modes.save(id, this, prop)
|
||||
}
|
||||
})
|
||||
}, desc));
|
||||
|
||||
Reference in New Issue
Block a user