Fix issue where changing the case of a vim object would be clipped at the end of the line (#24163)

Ben Kunkle and Conrad Irwin created

Co-authored-by: Conrad Irwin <conrad@zed.dev>

Closes #24124

Release Notes:

- Fixed an issue in vim mode where changing the case of an object at the
end of the line would not change the case of the last character in the
object

Co-authored-by: Conrad Irwin <conrad@zed.dev>

Change summary

crates/vim/src/normal/case.rs                            | 11 ++++++++++
crates/vim/test_data/test_change_case_motion_object.json |  6 +++++
2 files changed, 17 insertions(+)

Detailed changes

crates/vim/src/normal/case.rs 🔗

@@ -73,6 +73,7 @@ impl Vim {
         self.stop_recording(cx);
         self.update_editor(window, cx, |_, editor, window, cx| {
             editor.transact(window, cx, |editor, window, cx| {
+                editor.set_clip_at_line_ends(false, cx);
                 let mut original_positions: HashMap<_, _> = Default::default();
                 editor.change_selections(None, window, cx, |s| {
                     s.move_with(|map, selection| {
@@ -100,6 +101,7 @@ impl Vim {
                         selection.collapse_to(anchor.to_display_point(map), SelectionGoal::None);
                     });
                 });
+                editor.set_clip_at_line_ends(true, cx);
             });
         });
     }
@@ -306,4 +308,13 @@ mod test {
         cx.simulate_shared_keystrokes("g shift-u $").await;
         cx.shared_state().await.assert_eq("ˇABC DEF");
     }
+
+    #[gpui::test]
+    async fn test_change_case_motion_object(cx: &mut gpui::TestAppContext) {
+        let mut cx = NeovimBackedTestContext::new(cx).await;
+
+        cx.set_shared_state("abc dˇef\n").await;
+        cx.simulate_shared_keystrokes("g shift-u i w").await;
+        cx.shared_state().await.assert_eq("abc ˇDEF\n");
+    }
 }