mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 00:38:00 +01:00
Apply 'timeout' to unbound keys too.
This commit is contained in:
@@ -47,7 +47,7 @@ var ProcessorStack = Class("ProcessorStack", {
|
|||||||
notify: function () {
|
notify: function () {
|
||||||
events.keyEvents = [];
|
events.keyEvents = [];
|
||||||
events.processor = null;
|
events.processor = null;
|
||||||
if (!this.execute(Events.KILL, true)) {
|
if (!this.execute(undefined, true)) {
|
||||||
events.processor = this;
|
events.processor = this;
|
||||||
events.keyEvents = this.keyEvents;
|
events.keyEvents = this.keyEvents;
|
||||||
}
|
}
|
||||||
@@ -60,14 +60,16 @@ var ProcessorStack = Class("ProcessorStack", {
|
|||||||
callable(result) ? result.toSource().substr(0, 50) : result),
|
callable(result) ? result.toSource().substr(0, 50) : result),
|
||||||
|
|
||||||
execute: function execute(result, force) {
|
execute: function execute(result, force) {
|
||||||
|
let processors = this.processors;
|
||||||
|
util.dump("execute", this._result(result), force, String(processors.map(function (p) [p.main, p.main.passUnknown])));
|
||||||
|
|
||||||
if (force && this.actions.length)
|
if (force)
|
||||||
this.processors.length = 0;
|
this.processors = [];
|
||||||
|
|
||||||
if (this.ownsBuffer)
|
if (this.ownsBuffer)
|
||||||
statusline.inputBuffer = this.processors.length ? this.buffer : "";
|
statusline.inputBuffer = this.processors.length ? this.buffer : "";
|
||||||
|
|
||||||
if (!this.processors.some(function (p) !p.extended) && this.actions.length) {
|
if (!processors.some(function (p) !p.extended) && this.actions.length) {
|
||||||
if (this._actions.length == 0) {
|
if (this._actions.length == 0) {
|
||||||
dactyl.beep();
|
dactyl.beep();
|
||||||
events.feedingKeys = false;
|
events.feedingKeys = false;
|
||||||
@@ -88,12 +90,12 @@ var ProcessorStack = Class("ProcessorStack", {
|
|||||||
}
|
}
|
||||||
else if (this.processors.length) {
|
else if (this.processors.length) {
|
||||||
result = Events.KILL;
|
result = Events.KILL;
|
||||||
if (this.actions.length && options["timeout"])
|
if (options["timeout"])
|
||||||
this.timer = services.Timer(this, options["timeoutlen"], services.Timer.TYPE_ONE_SHOT);
|
this.timer = services.Timer(this, options["timeoutlen"], services.Timer.TYPE_ONE_SHOT);
|
||||||
}
|
}
|
||||||
else if (result !== Events.KILL && !this.actions.length &&
|
else if (result !== Events.KILL && !this.actions.length &&
|
||||||
(this.events.length > 1 ||
|
(this.events.length > 1 ||
|
||||||
this.processors.some(function (p) !p.main.passUnknown))) {
|
processors.some(function (p) !p.main.passUnknown))) {
|
||||||
result = Events.KILL;
|
result = Events.KILL;
|
||||||
if (!Events.isEscape(this.events.slice(-1)[0]))
|
if (!Events.isEscape(this.events.slice(-1)[0]))
|
||||||
dactyl.beep();
|
dactyl.beep();
|
||||||
@@ -356,7 +358,6 @@ var Events = Module("events", {
|
|||||||
dbg: function () {},
|
dbg: function () {},
|
||||||
|
|
||||||
init: function () {
|
init: function () {
|
||||||
const self = this;
|
|
||||||
this.keyEvents = [];
|
this.keyEvents = [];
|
||||||
|
|
||||||
update(this, {
|
update(this, {
|
||||||
@@ -452,15 +453,14 @@ var Events = Module("events", {
|
|||||||
|
|
||||||
this._activeMenubar = false;
|
this._activeMenubar = false;
|
||||||
this.listen(window, this, "events", true);
|
this.listen(window, this, "events", true);
|
||||||
|
|
||||||
dactyl.registerObserver("modeChange", function () {
|
|
||||||
delete self.processor;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
signals: {
|
signals: {
|
||||||
"browser.locationChange": function (webProgress, request, uri) {
|
"browser.locationChange": function (webProgress, request, uri) {
|
||||||
options.get("passkeys").flush();
|
options.get("passkeys").flush();
|
||||||
|
},
|
||||||
|
"modes.change": function (oldMode, newMode) {
|
||||||
|
delete this.processor;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ var Modes = Module("modes", {
|
|||||||
if (!mode.extended)
|
if (!mode.extended)
|
||||||
this._mainModes.push(mode);
|
this._mainModes.push(mode);
|
||||||
|
|
||||||
dactyl.triggerObserver("mode-add", mode);
|
dactyl.triggerObserver("modes.add", mode);
|
||||||
},
|
},
|
||||||
|
|
||||||
dumpStack: function dumpStack() {
|
dumpStack: function dumpStack() {
|
||||||
@@ -370,7 +370,7 @@ var Modes = Module("modes", {
|
|||||||
push ? { push: push } : stack || {},
|
push ? { push: push } : stack || {},
|
||||||
prev);
|
prev);
|
||||||
|
|
||||||
dactyl.triggerObserver("modeChange", [oldMain, oldExtended], [this._main, this._extended], stack);
|
dactyl.triggerObserver("modes.change", [oldMain, oldExtended], [this._main, this._extended], stack);
|
||||||
this.show();
|
this.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user