mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-23 13:35:46 +01:00
Don't beep after canceling a key chain with <Esc>
This commit is contained in:
@@ -67,7 +67,8 @@ var ProcessorStack = Class("ProcessorStack", {
|
|||||||
(this.events.length > 1 ||
|
(this.events.length > 1 ||
|
||||||
this.processors.some(function (p) !p.main.passUnknown))) {
|
this.processors.some(function (p) !p.main.passUnknown))) {
|
||||||
result = Events.KILL;
|
result = Events.KILL;
|
||||||
dactyl.beep();
|
if (!Events.isEscape(this.events.slice(-1)[0]))
|
||||||
|
dactyl.beep();
|
||||||
events.feedingKeys = false;
|
events.feedingKeys = false;
|
||||||
}
|
}
|
||||||
else if (result === undefined)
|
else if (result === undefined)
|
||||||
@@ -80,7 +81,9 @@ var ProcessorStack = Class("ProcessorStack", {
|
|||||||
if (result !== Events.PASS)
|
if (result !== Events.PASS)
|
||||||
Events.kill(this.events[this.events.length - 1]);
|
Events.kill(this.events[this.events.length - 1]);
|
||||||
|
|
||||||
if (result === Events.PASS || result === Events.ABORT) {
|
if (result === Events.PASS_THROUGH)
|
||||||
|
events.feedevents(null, this.allEvents, { skipmap: true, isMacro: true, isReplay: true });
|
||||||
|
else if (result === Events.PASS || result === Events.ABORT) {
|
||||||
let list = this.events.filter(function (e) e.getPreventDefault() && !e.dactylDefaultPrevented);
|
let list = this.events.filter(function (e) e.getPreventDefault() && !e.dactylDefaultPrevented);
|
||||||
if (list.length)
|
if (list.length)
|
||||||
events.dbg("REFEED: " + list.map(events.closure.toString).join(""));
|
events.dbg("REFEED: " + list.map(events.closure.toString).join(""));
|
||||||
@@ -99,6 +102,8 @@ var ProcessorStack = Class("ProcessorStack", {
|
|||||||
|
|
||||||
let key = events.toString(event);
|
let key = events.toString(event);
|
||||||
this.events.push(event);
|
this.events.push(event);
|
||||||
|
if (this.allEvents)
|
||||||
|
this.allEvents.push(event);
|
||||||
|
|
||||||
this.buffer += key;
|
this.buffer += key;
|
||||||
|
|
||||||
@@ -314,6 +319,7 @@ var Events = Module("events", {
|
|||||||
|
|
||||||
init: function () {
|
init: function () {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
this.keyEvents = [];
|
||||||
|
|
||||||
update(this, {
|
update(this, {
|
||||||
hives: contexts.Hives("events", EventHive),
|
hives: contexts.Hives("events", EventHive),
|
||||||
@@ -1190,6 +1196,7 @@ var Events = Module("events", {
|
|||||||
let keyModes = array([mode.params.keyModes, main, mode.main.allBases]).flatten().compact();
|
let keyModes = array([mode.params.keyModes, main, mode.main.allBases]).flatten().compact();
|
||||||
|
|
||||||
this.processor = ProcessorStack(mode, hives, keyModes);
|
this.processor = ProcessorStack(mode, hives, keyModes);
|
||||||
|
this.processor.allEvents = this.keyEvents;
|
||||||
}
|
}
|
||||||
|
|
||||||
let processor = this.processor;
|
let processor = this.processor;
|
||||||
@@ -1197,6 +1204,8 @@ var Events = Module("events", {
|
|||||||
|
|
||||||
if (!processor.process(event))
|
if (!processor.process(event))
|
||||||
this.processor = processor;
|
this.processor = processor;
|
||||||
|
else
|
||||||
|
this.keyEvents = [];
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
@@ -1223,13 +1232,12 @@ var Events = Module("events", {
|
|||||||
// "keypress" event.
|
// "keypress" event.
|
||||||
|
|
||||||
if (modes.main == modes.PASS_THROUGH ||
|
if (modes.main == modes.PASS_THROUGH ||
|
||||||
modes.main == modes.QUOTE
|
modes.main == modes.QUOTE
|
||||||
&& modes.getStack(1).main !== modes.PASS_THROUGH
|
&& modes.getStack(1).main !== modes.PASS_THROUGH
|
||||||
&& !events.shouldPass(event) ||
|
&& !events.shouldPass(event) ||
|
||||||
!modes.passThrough && events.shouldPass(event))
|
!modes.passThrough && events.shouldPass(event))
|
||||||
return;
|
this.keyEvents.push(event);
|
||||||
|
else if (!Events.isInputElement(dactyl.focusedElement))
|
||||||
if (!Events.isInputElement(dactyl.focusedElement))
|
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
},
|
},
|
||||||
keydown: function onKeyDown(event) {
|
keydown: function onKeyDown(event) {
|
||||||
@@ -1365,6 +1373,7 @@ var Events = Module("events", {
|
|||||||
ABORT: {},
|
ABORT: {},
|
||||||
KILL: true,
|
KILL: true,
|
||||||
PASS: false,
|
PASS: false,
|
||||||
|
PASS_THROUGH: {},
|
||||||
WAIT: null,
|
WAIT: null,
|
||||||
|
|
||||||
isEscape: function isEscape(event)
|
isEscape: function isEscape(event)
|
||||||
|
|||||||
@@ -388,6 +388,7 @@ var Contexts = Module("contexts", {
|
|||||||
else
|
else
|
||||||
action = dactyl.userFunc.apply(dactyl, params.concat(args.literalArg).array);
|
action = dactyl.userFunc.apply(dactyl, params.concat(args.literalArg).array);
|
||||||
process = function (param) isObject(param) && param.valueOf ? param.valueOf() : param;
|
process = function (param) isObject(param) && param.valueOf ? param.valueOf() : param;
|
||||||
|
action.params = params;
|
||||||
action.makeParams = makeParams;
|
action.makeParams = makeParams;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user