From 60374460f263aaf56b8c1ced54f7731c0324b1f5 Mon Sep 17 00:00:00 2001 From: Pulkit Saraf <146842937+Pulkit7070@users.noreply.github.com> Date: Thu, 28 May 2026 08:06:38 +0530 Subject: [PATCH] helix: Fix a cursor position in helix_select mode` (#57610) Closes #56493 In Helix select mode, pressing `a` after a selection (e.g. `v a`) placed the cursor one column too far to the right. Bound `a` to `vim::HelixAppend` in the `helix_select` keymap so it matches the behavior in `helix_normal`, and added a regression test for the `v a` case. Release Notes: - Fixed cursor placement after pressing `a` in Helix select mode. --------- Co-authored-by: Smit Barmase --- assets/keymaps/vim.json | 2 +- crates/vim/src/helix.rs | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/assets/keymaps/vim.json b/assets/keymaps/vim.json index 1e731efd96c..ef414018681 100644 --- a/assets/keymaps/vim.json +++ b/assets/keymaps/vim.json @@ -338,7 +338,7 @@ "ctrl-x": "vim::Decrement", "shift-j": "vim::JoinLines", "i": "vim::InsertBefore", - "a": "vim::InsertAfter", + "a": "vim::HelixAppend", "o": "vim::InsertLineBelow", "shift-o": "vim::InsertLineAbove", "p": "vim::Paste", diff --git a/crates/vim/src/helix.rs b/crates/vim/src/helix.rs index b1ce35431c5..5c4b26cdaa0 100644 --- a/crates/vim/src/helix.rs +++ b/crates/vim/src/helix.rs @@ -2572,6 +2572,16 @@ mod test { assert_eq!(cx.mode(), Mode::HelixNormal); } + #[gpui::test] + async fn test_helix_select_append(cx: &mut gpui::TestAppContext) { + let mut cx = VimTestContext::new(cx, true).await; + cx.enable_helix(); + + cx.set_state("aˇbcd", Mode::HelixNormal); + cx.simulate_keystrokes("v a"); + cx.assert_state("abˇcd", Mode::Insert); + } + #[gpui::test] async fn test_goto_last_modification(cx: &mut gpui::TestAppContext) { let mut cx = VimTestContext::new(cx, true).await;