From c3ac9c13dffaa79827602536519bc64d65689d05 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 31 May 2021 21:35:44 -0400 Subject: vim-patch:8.2.2916: operators are not fully tested Problem: Operators are not fully tested. Solution: Add a few more tests. (Yegappan Lakshmanan, closes vim/vim#8290) https://github.com/vim/vim/commit/2ac7184d34cd01e2b76bd1f704fd6a4b4af10239 --- src/nvim/testdir/test_normal.vim | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/nvim/testdir/test_normal.vim') diff --git a/src/nvim/testdir/test_normal.vim b/src/nvim/testdir/test_normal.vim index e9de94c0b3..4a00999c45 100644 --- a/src/nvim/testdir/test_normal.vim +++ b/src/nvim/testdir/test_normal.vim @@ -2883,3 +2883,35 @@ func Test_normal_gk() bw! set cpoptions& number& numberwidth& endfunc + +" Some commands like yy, cc, dd, >>, << and !! accept a count after +" typing the first letter of the command. +func Test_normal_count_after_operator() + new + setlocal shiftwidth=4 tabstop=8 autoindent + call setline(1, ['one', 'two', 'three', 'four', 'five']) + let @a = '' + normal! j"ay4y + call assert_equal("two\nthree\nfour\nfive\n", @a) + normal! 3G>2> + call assert_equal(['one', 'two', ' three', ' four', 'five'], + \ getline(1, '$')) + exe "normal! 3G0c2cred\nblue" + call assert_equal(['one', 'two', ' red', ' blue', 'five'], + \ getline(1, '$')) + exe "normal! gg<8<" + call assert_equal(['one', 'two', 'red', 'blue', 'five'], + \ getline(1, '$')) + exe "normal! ggd3d" + call assert_equal(['blue', 'five'], getline(1, '$')) + call setline(1, range(1, 4)) + call feedkeys("gg!3!\\"\", 'xt') + call assert_equal('".,.+2!', @:) + call feedkeys("gg!1!\\"\", 'xt') + call assert_equal('".!', @:) + call feedkeys("gg!9!\\"\", 'xt') + call assert_equal('".,$!', @:) + bw! +endfunc + +" vim: shiftwidth=2 sts=2 expandtab -- cgit