From be95716e94948d3d01df523d83c29aedff77009e Mon Sep 17 00:00:00 2001 From: vipex <101529155+vipexv@users.noreply.github.com> Date: Tue, 24 Jun 2025 23:20:14 +0200 Subject: [PATCH] helix: Prevent cursor move on entering insert mode (#33201) Closes #33061 https://github.com/user-attachments/assets/3b3e146e-7c12-412e-b4dd-c70411891b9e Release Notes: - Fixed cursor unexpectedly moving when entering/exiting insert mode in Helix mode, making the behavior consistent with the Helix editor. --- crates/vim/src/insert.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/vim/src/insert.rs b/crates/vim/src/insert.rs index 585f324683..a30af8769f 100644 --- a/crates/vim/src/insert.rs +++ b/crates/vim/src/insert.rs @@ -29,15 +29,20 @@ impl Vim { self.stop_recording_immediately(action.boxed_clone(), cx); if count <= 1 || Vim::globals(cx).dot_replaying { self.create_mark("^".into(), window, cx); + self.update_editor(window, cx, |_, editor, window, cx| { editor.dismiss_menus_and_popups(false, window, cx); - editor.change_selections(Some(Autoscroll::fit()), window, cx, |s| { - s.move_cursors_with(|map, mut cursor, _| { - *cursor.column_mut() = cursor.column().saturating_sub(1); - (map.clip_point(cursor, Bias::Left), SelectionGoal::None) + + if !HelixModeSetting::get_global(cx).0 { + editor.change_selections(Some(Autoscroll::fit()), window, cx, |s| { + s.move_cursors_with(|map, mut cursor, _| { + *cursor.column_mut() = cursor.column().saturating_sub(1); + (map.clip_point(cursor, Bias::Left), SelectionGoal::None) + }); }); - }); + } }); + if HelixModeSetting::get_global(cx).0 { self.switch_mode(Mode::HelixNormal, false, window, cx); } else {