vim: Fix vim delete to line (#23053)
Closes #23024 Release Notes: - Fixed Vim `dxG` delete to line --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
parent
93f117b21a
commit
03c99e39f9
2 changed files with 51 additions and 1 deletions
|
@ -50,7 +50,7 @@ impl Vim {
|
||||||
{
|
{
|
||||||
selection.end = next_line
|
selection.end = next_line
|
||||||
}
|
}
|
||||||
Motion::EndOfDocument {} => {
|
Motion::EndOfDocument {} if times.is_none() => {
|
||||||
// Deleting until the end of the document includes the last line, including
|
// Deleting until the end of the document includes the last line, including
|
||||||
// soft-wrapped lines.
|
// soft-wrapped lines.
|
||||||
selection.end = map.max_point()
|
selection.end = map.max_point()
|
||||||
|
@ -486,6 +486,41 @@ mod test {
|
||||||
.assert_matches();
|
.assert_matches();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[gpui::test]
|
||||||
|
async fn test_delete_to_line(cx: &mut gpui::TestAppContext) {
|
||||||
|
let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||||
|
cx.simulate(
|
||||||
|
"d 3 shift-g",
|
||||||
|
indoc! {"
|
||||||
|
The quick
|
||||||
|
brownˇ fox
|
||||||
|
jumps over
|
||||||
|
the lazy"},
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.assert_matches();
|
||||||
|
cx.simulate(
|
||||||
|
"d 3 shift-g",
|
||||||
|
indoc! {"
|
||||||
|
The quick
|
||||||
|
brown fox
|
||||||
|
jumps over
|
||||||
|
the lˇazy"},
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.assert_matches();
|
||||||
|
cx.simulate(
|
||||||
|
"d 2 shift-g",
|
||||||
|
indoc! {"
|
||||||
|
The quick
|
||||||
|
brown fox
|
||||||
|
jumps over
|
||||||
|
ˇ"},
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.assert_matches();
|
||||||
|
}
|
||||||
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
async fn test_delete_gg(cx: &mut gpui::TestAppContext) {
|
async fn test_delete_gg(cx: &mut gpui::TestAppContext) {
|
||||||
let mut cx = NeovimBackedTestContext::new(cx).await;
|
let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||||
|
|
15
crates/vim/test_data/test_delete_to_line.json
Normal file
15
crates/vim/test_data/test_delete_to_line.json
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{"Put":{"state":"The quick\nbrownˇ fox\njumps over\nthe lazy"}}
|
||||||
|
{"Key":"d"}
|
||||||
|
{"Key":"3"}
|
||||||
|
{"Key":"shift-g"}
|
||||||
|
{"Get":{"state":"The quick\nthe lˇazy","mode":"Normal"}}
|
||||||
|
{"Put":{"state":"The quick\nbrown fox\njumps over\nthe lˇazy"}}
|
||||||
|
{"Key":"d"}
|
||||||
|
{"Key":"3"}
|
||||||
|
{"Key":"shift-g"}
|
||||||
|
{"Get":{"state":"The quick\nbrownˇ fox","mode":"Normal"}}
|
||||||
|
{"Put":{"state":"The quick\nbrown fox\njumps over\nˇ"}}
|
||||||
|
{"Key":"d"}
|
||||||
|
{"Key":"2"}
|
||||||
|
{"Key":"shift-g"}
|
||||||
|
{"Get":{"state":"ˇThe quick","mode":"Normal"}}
|
Loading…
Add table
Add a link
Reference in a new issue