Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

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

Joel Courtneyecf4d5539ea1
diff --git a/crates/vim/src/helix.rs b/crates/vim/src/helix.rs
index e271c06a5e6..ec9b959b122 100644
--- a/crates/vim/src/helix.rs
+++ b/crates/vim/src/helix.rs
@@ -368,40 +368,40 @@ mod test {
cx.assert_state("aa\n«ˇ »bb", Mode::HelixNormal);
}
- // #[gpui::test]
- // async fn test_delete(cx: &mut gpui::TestAppContext) {
- // let mut cx = VimTestContext::new(cx, true).await;
+ #[gpui::test]
+ async fn test_delete(cx: &mut gpui::TestAppContext) {
+ let mut cx = VimTestContext::new(cx, true).await;
- // // test delete a selection
- // cx.set_state(
- // indoc! {"
- // The qu«ick ˇ»brown
- // fox jumps over
- // the lazy dog."},
- // Mode::HelixNormal,
- // );
+ // test delete a selection
+ cx.set_state(
+ indoc! {"
+ The qu«ick ˇ»brown
+ fox jumps over
+ the lazy dog."},
+ Mode::HelixNormal,
+ );
- // cx.simulate_keystrokes("d");
+ cx.simulate_keystrokes("d");
- // cx.assert_state(
- // indoc! {"
- // The quˇbrown
- // fox jumps over
- // the lazy dog."},
- // Mode::HelixNormal,
- // );
+ cx.assert_state(
+ indoc! {"
+ The quˇbrown
+ fox jumps over
+ the lazy dog."},
+ Mode::HelixNormal,
+ );
- // // test deleting a single character
- // cx.simulate_keystrokes("d");
+ // test deleting a single character
+ cx.simulate_keystrokes("d");
- // cx.assert_state(
- // indoc! {"
- // The quˇrown
- // fox jumps over
- // the lazy dog."},
- // Mode::HelixNormal,
- // );
- // }
+ cx.assert_state(
+ indoc! {"
+ The quˇrown
+ fox jumps over
+ the lazy dog."},
+ Mode::HelixNormal,
+ );
+ }
// #[gpui::test]
// async fn test_delete_character_end_of_line(cx: &mut gpui::TestAppContext) {
diff --git a/crates/vim/src/normal.rs b/crates/vim/src/normal.rs
index baaf6bc3c44..6131032f4fa 100644
--- a/crates/vim/src/normal.rs
+++ b/crates/vim/src/normal.rs
@@ -140,6 +140,7 @@ pub(crate) fn register(editor: &mut Editor, cx: &mut Context<Vim>) {
})
});
vim.visual_delete(false, window, cx);
+ vim.switch_mode(Mode::HelixNormal, true, window, cx);
});
Vim::action(editor, cx, |vim, _: &ChangeToEndOfLine, window, cx| {