Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
helix: Return to normal mode after pasting in select mode (#65492)
Raum Dellamorte50304070c283
diff --git a/crates/vim/src/helix.rs b/crates/vim/src/helix.rsindex cf3323f4a53..eacc807a01d 100644--- a/crates/vim/src/helix.rs+++ b/crates/vim/src/helix.rs@@ -2834,11 +2834,18 @@ mod test {cx.assert_state("foo hello worldˇbar", Mode::HelixNormal);- // Test paste with shift-r on selection+ // Test paste with shift-r on selection from Helix Normal Modecx.set_state("foo «barˇ» baz", Mode::HelixNormal);cx.simulate_keystrokes("shift-r");cx.assert_state("foo hello worldˇ baz", Mode::HelixNormal);++ // Test shift-r paste on selection from Helix Select Mode returns to Helix Normal Mode+ cx.set_state("foo «barˇ» baz fizz", Mode::HelixSelect);+ cx.simulate_keystrokes("e"); // if we're in Select Mode, the selection should be extended to include ` baz`+ cx.simulate_keystrokes("shift-r");++ cx.assert_state("foo hello worldˇ fizz", Mode::HelixNormal);}#[gpui::test]diff --git a/crates/vim/src/vim.rs b/crates/vim/src/vim.rsindex c016bd6d415..c4d56a86cb8 100644--- a/crates/vim/src/vim.rs+++ b/crates/vim/src/vim.rs@@ -987,6 +987,9 @@ impl Vim {}_ => {vim.update_editor(cx, |_, editor, cx| editor.paste(&Paste, window, cx));+ if vim.mode == Mode::HelixSelect {+ vim.switch_mode(Mode::HelixNormal, true, window, cx);+ }}},);