Skip to content

Commit 2b6bdbc

Browse files
zeertzjqchrisbra
authored andcommitted
patch 9.1.2105: tests: not enough tests for using plain_vgetc()
Problem: Not enough tests for using plain_vgetc(). Solution: Add tests for using plain_vgetc() during various commands. (zeertzjq) closes: #19236 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 3a324c8 commit 2b6bdbc

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

src/testdir/test_input.vim

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,54 @@ func Test_input_simplify_timedout()
5858
bw!
5959
endfunc
6060

61+
" Check that <Ignore> and <MouseMove> are no-op in the middle of various
62+
" commands as they are ignored by plain_vgetc().
63+
func Test_input_noop_keys()
64+
for key in ["\<Ignore>", "\<MouseMove>"]
65+
20new
66+
setlocal scrolloff=0
67+
68+
let lines = range(1, 100)->mapnew({_, n -> $'line {n}'})
69+
call setline(1, lines)
70+
let InsertNoopKeys = {s -> key .. split(s, '\zs')->join(key) .. key}
71+
72+
call feedkeys(InsertNoopKeys("60z\<CR>\<C-\>\<C-N>"), 'tnix')
73+
call assert_equal(60, line('w0'))
74+
call assert_equal('line 60', getline('.'))
75+
76+
call feedkeys(InsertNoopKeys("gg20ddi\<C-V>x5F\<Esc>"), 'tnix')
77+
call assert_equal(80, line('$'))
78+
call assert_equal('_line 21', getline('.'))
79+
80+
call feedkeys(InsertNoopKeys("fea\<C-K>,.\<C-\>\<C-N>"), 'tnix')
81+
call assert_equal('_line… 21', getline('.'))
82+
83+
call feedkeys(InsertNoopKeys("Iabcde\<C-G>ufghij\<Esc>u"), 'tnix')
84+
call assert_equal('abcde_line… 21', getline('.'))
85+
call feedkeys("\<C-R>$2Feg~tj", 'tnix')
86+
call assert_equal('abcdEFGHIj_line… 21', getline('.'))
87+
88+
let @g = 'FOO'
89+
call feedkeys(InsertNoopKeys("A\<C-R>g\<C-R>\<C-O>g\<Esc>"), 'tnix')
90+
call assert_equal('abcdEFGHIj_line… 21FOOFOO', getline('.'))
91+
92+
call feedkeys(InsertNoopKeys("0v10l\<C-G>\<C-R>g?!!\<Esc>"), 'tnix')
93+
call assert_equal('abcdEFGHIj_', @g)
94+
call assert_equal('?!!line… 21FOOFOO', getline('.'))
95+
96+
let @g = 'BAR'
97+
call feedkeys(InsertNoopKeys("$:\"abc\<C-R>\<C-R>\<C-W>\<CR>"), 'tnix')
98+
call assert_equal('"abc21FOOFOO', @:)
99+
call feedkeys(InsertNoopKeys(":\<C-\>e'\"foo'\<CR>\<C-R>g\<CR>"), 'tnix')
100+
call assert_equal('"fooBAR', @:)
101+
102+
call feedkeys(InsertNoopKeys("z10\<CR>"), 'tnix')
103+
call assert_equal(10, winheight(0))
104+
call feedkeys(InsertNoopKeys("\<C-W>10+"), 'tnix')
105+
call assert_equal(20, winheight(0))
106+
107+
bwipe!
108+
endfor
109+
endfunc
110+
61111
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,8 @@ static char *(features[]) =
734734

735735
static int included_patches[] =
736736
{ /* Add new patch number below this line */
737+
/**/
738+
2105,
737739
/**/
738740
2104,
739741
/**/

0 commit comments

Comments
 (0)