vim: Fix replace in helix select mode (#57553)

Resolves https://github.com/zed-industries/zed/issues/57522

This diff fixes `r` in Helix select mode. The keybinding already pushed
the replace operator in `helix_select`, but when the replacement
character was typed, the operator dispatch only handled `HelixNormal`,
so selected text in `HelixSelect` fell through and cleared the operator
without editing the buffer.

With this change, Helix select mode uses the same `helix_replace` path
as Helix normal mode. Multi-character selections now replace each
selected grapheme with the typed character and return to Helix normal
mode, matching the existing behaviour for Helix normal selections.

Release Notes:
- Fixed `r` not replacing multi-character selections in Helix select
mode.
This commit is contained in:
liam authored and GitHub committed 2026-05-26 14:15:31 +00:00
1 parent e7b081dd52
commit ba41a8b6cb
2 files changed
+7 -1

No files matched your search

+6
View File
@@ -2482,6 +2482,12 @@ mod test {
cx.simulate_keystrokes("r x");
cx.assert_state("«xxˇ»", Mode::HelixNormal);
cx.set_state("«aaˇ»", Mode::HelixSelect);
cx.simulate_keystrokes("r x");
cx.assert_state("«xxˇ»", Mode::HelixNormal);
}
#[gpui::test]
+1 -1
View File
@@ -2066,7 +2066,7 @@ impl Vim {
Mode::Visual | Mode::VisualLine | Mode::VisualBlock => {
self.visual_replace(text, window, cx)
}
Mode::HelixNormal => self.helix_replace(&text, window, cx),
Mode::HelixNormal | Mode::HelixSelect => self.helix_replace(&text, window, cx),
_ => self.clear_operator(window, cx),
},
Some(Operator::Digraph { first_char }) => {