From 1ba706211dc3ffd75460b03ec75b05989f8b70de Mon Sep 17 00:00:00 2001 From: gdh1995 Date: Mon, 1 Jan 2024 20:34:58 +0800 Subject: [PATCH] VisualMode: treat 2+0 as number prefix for https://github.com/gdh1995/vimium-c/issues/1065 --- content/visual.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/content/visual.ts b/content/visual.ts index eb44b398d..d75286d19 100644 --- a/content/visual.ts +++ b/content/visual.ts @@ -791,9 +791,10 @@ const ensureLine = (command1: number, s0: string): void => { return esc!(HandlerResult.Prevent) } const childAction = keyMap[currentPrefix + key], - newActions = ( /^v\d/).test(key) ? +key.slice(1) : childAction || keyMap[key] - if (!(newActions as VisualAction >= 0)) { - // asserts newActions is VisualAction.NextKey | NaN undefined + newActions = ( /^v\d/).test(key) ? +key.slice(1) : key === "0" && currentKeys ? void 0 + : childAction || keyMap[key] + if (!(newActions! >= 0)) { + // asserts newActions is VisualAction.NextKey | undefined (NaN) currentPrefix = newActions! < 0 ? key : "" return keybody < kChar.minNotF_num && keybody > kChar.maxNotF_num ? HandlerResult.Nothing : newActions ? HandlerResult.Prevent