helix: Stay in helix normal mode after helix delete (#34093)

Currently, the HelixDelete action switches to (vim) Normal mode instead
of HelixNormal mode. This adds a line to the helix delete action to stay
in helix normal mode.

There was already a commented-out test for this. I've uncommented it and
it now passes.

Release Notes:

- helix: Fixed switching to vim NORMAL mode instead of HELIX_NORMAL mode
after deletion
This commit is contained in:
Joel Courtney 2025-07-08 20:34:20 -07:00 committed by GitHub
parent 8e8a772c2d
commit ecf4d5539e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 30 additions and 29 deletions

View file

@ -368,40 +368,40 @@ mod test {
cx.assert_state("aa\n«ˇ »bb", Mode::HelixNormal); cx.assert_state("aa\n«ˇ »bb", Mode::HelixNormal);
} }
// #[gpui::test] #[gpui::test]
// async fn test_delete(cx: &mut gpui::TestAppContext) { async fn test_delete(cx: &mut gpui::TestAppContext) {
// let mut cx = VimTestContext::new(cx, true).await; let mut cx = VimTestContext::new(cx, true).await;
// // test delete a selection // test delete a selection
// cx.set_state( cx.set_state(
// indoc! {" indoc! {"
// The qu«ick ˇ»brown The qu«ick ˇ»brown
// fox jumps over fox jumps over
// the lazy dog."}, the lazy dog."},
// Mode::HelixNormal, Mode::HelixNormal,
// ); );
// cx.simulate_keystrokes("d"); cx.simulate_keystrokes("d");
// cx.assert_state( cx.assert_state(
// indoc! {" indoc! {"
// The quˇbrown The quˇbrown
// fox jumps over fox jumps over
// the lazy dog."}, the lazy dog."},
// Mode::HelixNormal, Mode::HelixNormal,
// ); );
// // test deleting a single character // test deleting a single character
// cx.simulate_keystrokes("d"); cx.simulate_keystrokes("d");
// cx.assert_state( cx.assert_state(
// indoc! {" indoc! {"
// The quˇrown The quˇrown
// fox jumps over fox jumps over
// the lazy dog."}, the lazy dog."},
// Mode::HelixNormal, Mode::HelixNormal,
// ); );
// } }
// #[gpui::test] // #[gpui::test]
// async fn test_delete_character_end_of_line(cx: &mut gpui::TestAppContext) { // async fn test_delete_character_end_of_line(cx: &mut gpui::TestAppContext) {

View file

@ -140,6 +140,7 @@ pub(crate) fn register(editor: &mut Editor, cx: &mut Context<Vim>) {
}) })
}); });
vim.visual_delete(false, window, cx); vim.visual_delete(false, window, cx);
vim.switch_mode(Mode::HelixNormal, true, window, cx);
}); });
Vim::action(editor, cx, |vim, _: &ChangeToEndOfLine, window, cx| { Vim::action(editor, cx, |vim, _: &ChangeToEndOfLine, window, cx| {