Vim mode: make motion::EndOfLine works with times. (#8591)

Release Notes:

- Fixed `$` in Vim mode not taking a numeric argument (i.e. `2$` or
`4$`) ([#8007](https://github.com/zed-industries/zed/issues/8007)).

---------

Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
This commit is contained in:
Wind 2024-03-01 21:00:31 +08:00 committed by GitHub
parent aeed9d0d8b
commit 9723ca95e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 58 additions and 7 deletions

View file

@ -152,6 +152,24 @@ async fn test_end_of_document_710(cx: &mut gpui::TestAppContext) {
cx.assert_editor_state("aˇa\nbb\ncc");
}
#[gpui::test]
async fn test_end_of_line_with_times(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
// goes to current line end
cx.set_state(indoc! {"ˇaa\nbb\ncc"}, Mode::Normal);
cx.simulate_keystrokes(["$"]);
cx.assert_editor_state("aˇa\nbb\ncc");
// goes to next line end
cx.simulate_keystrokes(["2", "$"]);
cx.assert_editor_state("aa\nbˇb\ncc");
// try to exceed the final line.
cx.simulate_keystrokes(["4", "$"]);
cx.assert_editor_state("aa\nbb\ncˇc");
}
#[gpui::test]
async fn test_indent_outdent(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;