vim: Fix cursor movement after entering Helix normal mode (#40528)

Closes #40009 

Release Notes:

- `vim::NormalBefore` now enters `helix_normal` correctly.
This commit is contained in:
paneutral
2025-10-23 11:15:12 +00:00
committed by GitHub
parent 8c1b4cb1cd
commit 93ef1947b5
+13 -7
View File
@@ -50,17 +50,23 @@ impl Vim {
if count <= 1 || Vim::globals(cx).dot_replaying {
self.create_mark("^".into(), window, cx);
if HelixModeSetting::get_global(cx).0 {
self.update_editor(cx, |_, editor, cx| {
editor.dismiss_menus_and_popups(false, window, cx);
});
self.switch_mode(Mode::HelixNormal, false, window, cx);
return;
}
self.update_editor(cx, |_, editor, cx| {
editor.dismiss_menus_and_popups(false, window, cx);
if !HelixModeSetting::get_global(cx).0 {
editor.change_selections(Default::default(), 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)
});
editor.change_selections(Default::default(), 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)
});
}
});
});
self.switch_mode(Mode::Normal, false, window, cx);