Fix issue where changing the case of a vim object would be clipped at the end of the line (#24163)
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>
This commit is contained in:
parent
8742c18107
commit
daf09fa532
2 changed files with 17 additions and 0 deletions
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
6
crates/vim/test_data/test_change_case_motion_object.json
Normal file
6
crates/vim/test_data/test_change_case_motion_object.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{"Put":{"state":"abc dˇef\n"}}
|
||||
{"Key":"g"}
|
||||
{"Key":"shift-u"}
|
||||
{"Key":"i"}
|
||||
{"Key":"w"}
|
||||
{"Get":{"state":"abc ˇDEF\n","mode":"Normal"}}
|
Loading…
Add table
Add a link
Reference in a new issue