mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-01 13:35:47 +01:00
Reject attempts to record non-letter-named macros.
This commit is contained in:
@@ -246,15 +246,15 @@ var Events = Module("events", {
|
|||||||
|
|
||||||
modes.recording = macro;
|
modes.recording = macro;
|
||||||
|
|
||||||
if (/[A-Z]/.test(macro)) { // uppercase (append)
|
if (/[A-Z]/.test(macro)) { // Append.
|
||||||
macro = macro.toLowerCase();
|
macro = macro.toLowerCase();
|
||||||
this._macroKeys = DOM.Event.iterKeys((this._macros.get(macro) || { keys: "" }).keys)
|
this._macroKeys = DOM.Event.iterKeys((this._macros.get(macro) || { keys: "" }).keys)
|
||||||
.toArray();
|
.toArray();
|
||||||
}
|
}
|
||||||
else if (macro) {
|
else if (macro) { // Record afresh.
|
||||||
this._macroKeys = [];
|
this._macroKeys = [];
|
||||||
}
|
}
|
||||||
else if (this.recording) {
|
else if (this.recording) { // Save.
|
||||||
this._macros.set(this.recording, {
|
this._macros.set(this.recording, {
|
||||||
keys: this._macroKeys.join(""),
|
keys: this._macroKeys.join(""),
|
||||||
timeRecorded: Date.now()
|
timeRecorded: Date.now()
|
||||||
@@ -1050,6 +1050,7 @@ var Events = Module("events", {
|
|||||||
mappings.add([modes.COMMAND],
|
mappings.add([modes.COMMAND],
|
||||||
["q", "<record-macro>"], "Record a key sequence into a macro",
|
["q", "<record-macro>"], "Record a key sequence into a macro",
|
||||||
function ({ arg }) {
|
function ({ arg }) {
|
||||||
|
util.assert(arg == null || /^[a-z]$/i.test(arg));
|
||||||
events._macroKeys.pop();
|
events._macroKeys.pop();
|
||||||
events.recording = arg;
|
events.recording = arg;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user