Skip to content

Fix f/F/t/T and ;/, dropping visual mode - #185

Merged
ernestrc merged 2 commits into
unstablebuild:mainfrom
drakeo338:claude/184-fix
Oct 7, 2026
Merged

ernestrc merged 2 commits into
unstablebuild:mainfrom
drakeo338:claude/184-fix

Conversation

@drakeo338

Copy link
Copy Markdown
Contributor

Fixes #184.

In Visual mode, the find-character motions f, F, t, T and their repeats ; and , switched the editor back to Normal mode, so a following x deleted the character under the cursor instead of the selection. The handler now keeps Visual mode for these motions and only moves the cursor. I added handler tests for each motion; they fail on the parent commit and pass with this change.


Authorship

  • Written by hand. I would like a human review.
  • Mostly or partially generated by an AI agent, which I reviewed and understand.

handleMoveToCharacter always called setNormalMode() after a character motion,
so pressing f, F, t, T, ; or , in visual, visual line or visual block mode
silently ended the selection mode and a following operator such as x or d acted on
nothing. Restore the visual mode that was active on entry; normal-mode callers
are unaffected.

Fixes unstablebuild#184

Signed-off-by: drakeo338 <[email protected]>
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ernestrc
ernestrc enabled auto-merge (squash) October 7, 2026 13:22
@ernestrc
ernestrc merged commit 94d5b2f into unstablebuild:main Oct 7, 2026
8 checks passed
ernestrc added a commit that referenced this pull request Oct 11, 2026
After #182 and #185, a differential run against Vim 9.1 still showed 109
operator mismatches. handleMetaNormal anchored every operator at the cursor and
treated every motion end as inclusive, so Vim's :h exclusive and :h linewise
rules, its register semantics and where it leaves the cursor were not modelled:
dh deleted the character under the cursor, db joined lines, and gU overwrote
the unnamed register.

Signed-off-by: ernestrc <[email protected]>
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.

Vim Visual mode 'f<character>' action causes a change to Normal mode

3 participants