1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-02 16:05:44 +01:00

Fix some mapping bugs.

This commit is contained in:
Kris Maglione
2010-12-22 22:44:01 -05:00
parent 2b0048061c
commit f36bd842a3

View File

@@ -820,13 +820,13 @@ const Events = Module("events", {
return null; return null;
if (modes.isRecording) { if (modes.isRecording) {
if (key == "q" && !modes.mainMode.input) { // TODO: should not be hard-coded if (key == "q" && !modes.main.input) { // TODO: should not be hard-coded
modes.isRecording = false; modes.isRecording = false;
dactyl.log("Recorded " + this._currentMacro + ": " + this._macros.get(this._currentMacro, {}).keys, 9); dactyl.log("Recorded " + this._currentMacro + ": " + this._macros.get(this._currentMacro, {}).keys, 9);
dactyl.echomsg("Recorded macro '" + this._currentMacro + "'"); dactyl.echomsg("Recorded macro '" + this._currentMacro + "'");
return killEvent(); return killEvent();
} }
else if (!mappings.hasMap(modes.main, this._input.buffer + key)) else if (this._input && !mappings.hasMap(modes.main, this._input.buffer + key))
this._macros.set(this._currentMacro, { this._macros.set(this._currentMacro, {
keys: this._macros.get(this._currentMacro, {}).keys + key, keys: this._macros.get(this._currentMacro, {}).keys + key,
timeRecorded: Date.now() timeRecorded: Date.now()
@@ -1090,14 +1090,11 @@ const Events = Module("events", {
} }
else if (this.pendingArgMap) { else if (this.pendingArgMap) {
let map = this.pendingArgMap; let map = this.pendingArgMap;
if (!Events.isEscape(key)) { if (!Events.isEscape(key))
if (!modes.isReplaying || this.waitForPageLoad()) if (!modes.isReplaying || this.waitForPageLoad())
execute(map, null, this.count, key); execute(map, null, this.count, key);
return true; return true;
}
} }
// only follow a map if there isn't a longer possible mapping
// (allows you to do :map z yy, when zz is a longer mapping than z)
else if (map && !event.skipmap && candidates.length == 0) { else if (map && !event.skipmap && candidates.length == 0) {
this.pendingMap = null; this.pendingMap = null;
@@ -1115,8 +1112,7 @@ const Events = Module("events", {
else if (this.pendingMotionMap) { else if (this.pendingMotionMap) {
if (!Events.isEscape(key)) if (!Events.isEscape(key))
execute(this.pendingMotionMap, candidateCommand, this.motionCount || this.count, null); execute(this.pendingMotionMap, candidateCommand, this.motionCount || this.count, null);
this.pendingMotionMap = null; return true;
this.motionCount = null;
} }
// no count support for these commands yet // no count support for these commands yet
else if (map.motion) else if (map.motion)
@@ -1126,10 +1122,8 @@ const Events = Module("events", {
return true; return true;
let ret = execute(map, null, this.count); let ret = execute(map, null, this.count);
if (map.route && ret) return map.route && ret;
return false;
} }
return true;
} }
else if (mappings.getCandidates(this.main, candidateCommand).length > 0 && !event.skipmap) { else if (mappings.getCandidates(this.main, candidateCommand).length > 0 && !event.skipmap) {
this.pendingMap = map; this.pendingMap = map;