mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 10:08:00 +01:00
Change the timing of mode-change callbacks slightly. Fix some message display bugs.
--HG-- branch : mode-refactoring
This commit is contained in:
@@ -440,6 +440,8 @@ const CommandLine = Module("commandline", {
|
|||||||
* @param {number} extendedMode
|
* @param {number} extendedMode
|
||||||
*/
|
*/
|
||||||
open: function open(prompt, cmd, extendedMode) {
|
open: function open(prompt, cmd, extendedMode) {
|
||||||
|
this.widgets.message = null;
|
||||||
|
|
||||||
modes.push(modes.COMMAND_LINE, this.currentExtendedMode, {
|
modes.push(modes.COMMAND_LINE, this.currentExtendedMode, {
|
||||||
leave: function (params) {
|
leave: function (params) {
|
||||||
if (params.pop)
|
if (params.pop)
|
||||||
@@ -556,6 +558,7 @@ const CommandLine = Module("commandline", {
|
|||||||
let doc = this.widgets.multilineOutput.contentDocument;
|
let doc = this.widgets.multilineOutput.contentDocument;
|
||||||
let win = this.widgets.multilineOutput.contentWindow;
|
let win = this.widgets.multilineOutput.contentWindow;
|
||||||
|
|
||||||
|
this.widgets.message = null;
|
||||||
if (!this.commandVisible)
|
if (!this.commandVisible)
|
||||||
this.hide();
|
this.hide();
|
||||||
|
|
||||||
|
|||||||
@@ -1020,12 +1020,6 @@ const Events = Module("events", {
|
|||||||
else if (dactyl.mode == modes.CARET)
|
else if (dactyl.mode == modes.CARET)
|
||||||
modes.push(modes.VISUAL);
|
modes.push(modes.VISUAL);
|
||||||
}
|
}
|
||||||
// XXX: disabled, as i think automatically starting visual caret mode does more harm than help
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// if (!couldCopy && modes.extended & modes.CARET)
|
|
||||||
// dactyl.mode = modes.CARET;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
editableInputs: set(["date", "datetime", "datetime-local", "email", "file",
|
editableInputs: set(["date", "datetime", "datetime-local", "email", "file",
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ const Modes = Module("modes", {
|
|||||||
let msg = null;
|
let msg = null;
|
||||||
if (options["showmode"])
|
if (options["showmode"])
|
||||||
msg = this._getModeMessage();
|
msg = this._getModeMessage();
|
||||||
|
if (loaded.commandline)
|
||||||
commandline.widgets.mode = msg || null;
|
commandline.widgets.mode = msg || null;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -199,8 +200,21 @@ const Modes = Module("modes", {
|
|||||||
if (!stack && mainMode != null && this._modeStack.length > 1)
|
if (!stack && mainMode != null && this._modeStack.length > 1)
|
||||||
this.reset();
|
this.reset();
|
||||||
|
|
||||||
|
let oldMain = this._main, oldExtended = this._extended;
|
||||||
|
|
||||||
|
if (typeof extendedMode === "number")
|
||||||
|
this._extended = extendedMode;
|
||||||
|
if (typeof mainMode === "number") {
|
||||||
|
this._main = mainMode;
|
||||||
|
if (!extendedMode)
|
||||||
|
this._extended = this.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stack && stack.pop && stack.pop.params.leave)
|
||||||
|
stack.pop.params.leave(stack, this.topOfStack);
|
||||||
|
|
||||||
let push = mainMode != null && !(stack && stack.pop) &&
|
let push = mainMode != null && !(stack && stack.pop) &&
|
||||||
Modes.StackElem(mainMode, extendedMode || this.NONE, params, {});
|
Modes.StackElem(this._main, this._extended, params, {});
|
||||||
if (push && this.topOfStack) {
|
if (push && this.topOfStack) {
|
||||||
if (this.topOfStack.params.leave)
|
if (this.topOfStack.params.leave)
|
||||||
this.topOfStack.params.leave({ push: push }, push);
|
this.topOfStack.params.leave({ push: push }, push);
|
||||||
@@ -212,18 +226,6 @@ const Modes = Module("modes", {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let silent = this._main === mainMode && this._extended === extendedMode;
|
|
||||||
// if a this._main mode is set, the this._extended is always cleared
|
|
||||||
let oldMain = this._main, oldExtended = this._extended;
|
|
||||||
|
|
||||||
if (typeof extendedMode === "number")
|
|
||||||
this._extended = extendedMode;
|
|
||||||
if (typeof mainMode === "number") {
|
|
||||||
this._main = mainMode;
|
|
||||||
if (!extendedMode)
|
|
||||||
this._extended = this.NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
let prev = stack && stack.pop || this.topOfStack;
|
let prev = stack && stack.pop || this.topOfStack;
|
||||||
if (push)
|
if (push)
|
||||||
this._modeStack.push(push);
|
this._modeStack.push(push);
|
||||||
@@ -232,8 +234,6 @@ const Modes = Module("modes", {
|
|||||||
prev);
|
prev);
|
||||||
|
|
||||||
dactyl.triggerObserver("modeChange", [oldMain, oldExtended], [this._main, this._extended], stack);
|
dactyl.triggerObserver("modeChange", [oldMain, oldExtended], [this._main, this._extended], stack);
|
||||||
|
|
||||||
if (!silent)
|
|
||||||
this.show();
|
this.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -244,9 +244,6 @@ const Modes = Module("modes", {
|
|||||||
pop: function (mode) {
|
pop: function (mode) {
|
||||||
while (this._modeStack.length > 1 && this.main != mode) {
|
while (this._modeStack.length > 1 && this.main != mode) {
|
||||||
let a = this._modeStack.pop();
|
let a = this._modeStack.pop();
|
||||||
if (a.params.leave)
|
|
||||||
a.params.leave({ pop: a }, this.topOfStack);
|
|
||||||
|
|
||||||
this.set(this.topOfStack.main, this.topOfStack.extended, this.topOfStack.params, { pop: a });
|
this.set(this.topOfStack.main, this.topOfStack.extended, this.topOfStack.params, { pop: a });
|
||||||
|
|
||||||
for (let [k, { obj, prop, value }] in Iterator(this.topOfStack.saved))
|
for (let [k, { obj, prop, value }] in Iterator(this.topOfStack.saved))
|
||||||
@@ -325,7 +322,7 @@ const Modes = Module("modes", {
|
|||||||
}, {
|
}, {
|
||||||
options: function () {
|
options: function () {
|
||||||
options.observePref("accessibility.browsewithcaret", function (value) {
|
options.observePref("accessibility.browsewithcaret", function (value) {
|
||||||
if (!value && modes.topOfStack.main === modes.CARET)
|
if (!value && modes.main === modes.CARET)
|
||||||
modes.pop();
|
modes.pop();
|
||||||
if (value && modes.main === modes.NORMAL)
|
if (value && modes.main === modes.NORMAL)
|
||||||
modes.push(modes.CARET);
|
modes.push(modes.CARET);
|
||||||
|
|||||||
Reference in New Issue
Block a user