From ecb874db62099873286012789569e4bd6ad80037 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Thu, 31 Oct 2024 23:25:54 -0600 Subject: [PATCH] vim: Fix gU$ (#20057) Closes: #19380 Release Notes: - vim: Fixed `gu$` missing last character of the line --- crates/vim/src/normal/case.rs | 7 ++++++- crates/vim/test_data/test_change_case_motion.json | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/vim/src/normal/case.rs b/crates/vim/src/normal/case.rs index 463bc62750..52e37bed4c 100644 --- a/crates/vim/src/normal/case.rs +++ b/crates/vim/src/normal/case.rs @@ -28,6 +28,7 @@ impl Vim { ) { self.stop_recording(cx); self.update_editor(cx, |_, editor, cx| { + editor.set_clip_at_line_ends(false, cx); let text_layout_details = editor.text_layout_details(cx); editor.transact(cx, |editor, cx| { let mut selection_starts: HashMap<_, _> = Default::default(); @@ -52,6 +53,7 @@ impl Vim { }); }); }); + editor.set_clip_at_line_ends(true, cx); }); } @@ -261,7 +263,7 @@ mod test { #[gpui::test] async fn test_change_case_motion(cx: &mut gpui::TestAppContext) { let mut cx = NeovimBackedTestContext::new(cx).await; - // works in visual mode + cx.set_shared_state("ˇabc def").await; cx.simulate_shared_keystrokes("g shift-u w").await; cx.shared_state().await.assert_eq("ˇABC def"); @@ -281,5 +283,8 @@ mod test { cx.simulate_shared_keystrokes(".").await; cx.shared_state().await.assert_eq("ˇabc def"); + + cx.simulate_shared_keystrokes("g shift-u $").await; + cx.shared_state().await.assert_eq("ˇABC DEF"); } } diff --git a/crates/vim/test_data/test_change_case_motion.json b/crates/vim/test_data/test_change_case_motion.json index 4d3600508f..18921f08a2 100644 --- a/crates/vim/test_data/test_change_case_motion.json +++ b/crates/vim/test_data/test_change_case_motion.json @@ -21,3 +21,7 @@ {"Get":{"state":"ˇABC def","mode":"Normal"}} {"Key":"."} {"Get":{"state":"ˇabc def","mode":"Normal"}} +{"Key":"g"} +{"Key":"shift-u"} +{"Key":"$"} +{"Get":{"state":"ˇABC DEF","mode":"Normal"}}