vim: Fix d shift-g not deleting until EOD if soft-wrap is on (#20160)

This previously didn't work: `d G` would delete to the end of the "first
of the soft-wrapped lines" of the last line.

To fix it, we special case the delete behavior for `shift-g`, which is
what Neovim also seems to do.


Release Notes:

- Fixed `d G` in Vim mode not deleting until the actual end of the
document if soft-wrap is turned on.
This commit is contained in:
Thorsten Ball 2024-11-05 14:47:14 +01:00 committed by GitHub
parent 4097118070
commit 7fb9549098
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 51 additions and 18 deletions

View file

@ -730,6 +730,24 @@ async fn test_wrapped_motions(cx: &mut gpui::TestAppContext) {
});
}
#[gpui::test]
async fn test_wrapped_delete_end_document(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_wrap(12).await;
cx.set_shared_state(indoc! {"
aaˇaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbb
cccccccccccccccccccc"
})
.await;
cx.simulate_shared_keystrokes("d shift-g i z z z").await;
cx.shared_state().await.assert_eq(indoc! {"
zzzˇ"
});
}
#[gpui::test]
async fn test_paragraphs_dont_wrap(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;