Skip to content

Prevent duplicate Vim motions from IME text updates - #284

Draft
thivux wants to merge 1 commit into
replit:masterfrom
thivux:fix/duplicate-ime-vim-motion
Draft

thivux wants to merge 1 commit into
replit:masterfrom
thivux:fix/duplicate-ime-vim-motion

Conversation

@thivux

@thivux thivux commented Nov 20, 2026

Copy link
Copy Markdown

Why

A Normal-mode motion can run twice when the input method delivers a second text update after the Vim adapter has handled the first. The reported symptom in Obsidian is that one tap of e with macOS Vietnamese Telex active can jump past the first word end. Similar duplicate motions are reported in #178.

What changed

Track whether the single-character input fallback is waiting for text or has already processed it. Consume a later single-character update without dispatching another Vim key. A new keydown or composition start resets the fallback, and the existing path that waits for an expected literal to finish composing still runs.

Test plan

  • The new Chrome regression test sends one Process keydown and two e text updates. Before the patch the cursor advanced from column 0 to column 10. With the patch it stops at column 4, the next keydown can move it to column 10, and the document is unchanged.
  • Ran pnpm typecheck, pnpm build, and pnpm testAll.
  • The test models duplicate text delivery. A physical Telex keypress still needs to be verified on macOS in the upstream demo and in Obsidian's bundled fork.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant