vim: Fix 1G

Before this change code could not distinguish between a user providing a
count of 1 and no count at all.

Fixes: zed-industries/community#710
This commit is contained in:
Conrad Irwin 2023-06-21 22:36:48 -06:00
parent 5291bf3d9f
commit 0cacf01f90
8 changed files with 49 additions and 26 deletions

View file

@ -109,3 +109,17 @@ async fn test_count_down(cx: &mut gpui::TestAppContext) {
cx.simulate_keystrokes(["9", "down"]);
cx.assert_editor_state("aa\nbb\ncc\ndd\neˇe");
}
#[gpui::test]
async fn test_end_of_document_710(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
// goes to end by default
cx.set_state(indoc! {"aˇa\nbb\ncc"}, Mode::Normal);
cx.simulate_keystrokes(["shift-g"]);
cx.assert_editor_state("aa\nbb\ncˇc");
// can go to line 1 (https://github.com/zed-industries/community/issues/710)
cx.simulate_keystrokes(["1", "shift-g"]);
cx.assert_editor_state("aˇa\nbb\ncc");
}