Skip to content

Commit 85aa458

Browse files
authored
helix: Drop back to normal mode after yanking in select mode (#38133)
Follow-up to #38117. @romaninsh I'd appreciate if you could have a look :-) Release Notes: - N/A
1 parent 37239fd commit 85aa458

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

crates/vim/src/helix.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,9 @@ impl Vim {
346346
);
347347
}
348348
});
349+
350+
// Drop back to normal mode after yanking
351+
self.switch_mode(Mode::HelixNormal, true, window, cx);
349352
}
350353

351354
fn helix_insert(&mut self, _: &HelixInsert, window: &mut Window, cx: &mut Context<Self>) {
@@ -842,7 +845,16 @@ mod test {
842845
cx.simulate_keystrokes("y");
843846
cx.shared_clipboard().assert_eq("worl");
844847
cx.assert_state("hello «worlˇ»d", Mode::HelixNormal);
848+
849+
// Test yanking in select mode character by character
850+
cx.set_state("hello ˇworld", Mode::HelixNormal);
851+
cx.simulate_keystroke("v");
852+
cx.assert_state("hello «wˇ»orld", Mode::HelixSelect);
853+
cx.simulate_keystroke("y");
854+
cx.assert_state("hello «wˇ»orld", Mode::HelixNormal);
855+
cx.shared_clipboard().assert_eq("w");
845856
}
857+
846858
#[gpui::test]
847859
async fn test_shift_r_paste(cx: &mut gpui::TestAppContext) {
848860
let mut cx = VimTestContext::new(cx, true).await;

0 commit comments

Comments
 (0)