1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-11 03:55:52 +01:00

Make 2dw do something sensible.

This commit is contained in:
Kris Maglione
2010-11-04 13:02:07 -04:00
parent a66c37088c
commit f89e548b12

View File

@@ -69,7 +69,8 @@ const Events = Module("events", {
buffer: "", // partial command storage buffer: "", // partial command storage
pendingMotionMap: null, // e.g. "d{motion}" if we wait for a motion of the "d" command pendingMotionMap: null, // e.g. "d{motion}" if we wait for a motion of the "d" command
pendingArgMap: null, // pending map storage for commands like m{a-z} pendingArgMap: null, // pending map storage for commands like m{a-z}
count: null // parsed count from the input buffer count: null, // parsed count from the input buffer
motionCount: null
}; };
this._activeMenubar = false; this._activeMenubar = false;
@@ -884,9 +885,10 @@ const Events = Module("events", {
// (allows you to do :map z yy, when zz is a longer mapping than z) // (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._input.pendingMap = null; this._input.pendingMap = null;
this._input.count = parseInt(countStr, 10); let count = this._input.pendingMotionMap ? "motionCount" : "count";
if (isNaN(this._input.count)) this._input[count] = parseInt(countStr, 10);
this._input.count = null; if (isNaN(this._input[count]))
this._input[count] = null;
this._input.buffer = ""; this._input.buffer = "";
if (map.arg) { if (map.arg) {
this._input.buffer = inputStr; this._input.buffer = inputStr;
@@ -894,8 +896,9 @@ const Events = Module("events", {
} }
else if (this._input.pendingMotionMap) { else if (this._input.pendingMotionMap) {
if (!isEscape(key)) if (!isEscape(key))
this._input.pendingMotionMap.execute(candidateCommand, this._input.count, null); this._input.pendingMotionMap.execute(candidateCommand, this._input.motionCount || this._input.count, null);
this._input.pendingMotionMap = null; this._input.pendingMotionMap = null;
this._input.motionCount = null;
} }
// no count support for these commands yet // no count support for these commands yet
else if (map.motion) { else if (map.motion) {
@@ -924,6 +927,7 @@ const Events = Module("events", {
this._input.pendingArgMap = null; this._input.pendingArgMap = null;
this._input.pendingMotionMap = null; this._input.pendingMotionMap = null;
this._input.pendingMap = null; this._input.pendingMap = null;
this._input.motionCount = null;
if (!isEscape(key)) { if (!isEscape(key)) {
// allow key to be passed to the host app if we can't handle it // allow key to be passed to the host app if we can't handle it