aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-05-09 14:09:06 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-05-09 17:16:22 +0800
commita501127899fc0ce444d4a31def51cb17cfbbf08f (patch)
tree238e47a3bf6f899f5634a2f8747bd689d3f1a5c7 /src
parentdfeb5b47bcde7984b2b1820f0268d0d5d736f98d (diff)
downloadrneovim-a501127899fc0ce444d4a31def51cb17cfbbf08f.tar.gz
rneovim-a501127899fc0ce444d4a31def51cb17cfbbf08f.tar.bz2
rneovim-a501127899fc0ce444d4a31def51cb17cfbbf08f.zip
vim-patch:8.2.4916: mouse in Insert mode test fails
Problem: Mouse in Insert mode test fails. Solution: Fix the text and check relevant positions. https://github.com/vim/vim/commit/8e8dc9b32326c6fbd37671b6072296404b481d4a Use nvim_input_mouse() to set mouse position, and discard mouse event using getchar().
Diffstat (limited to 'src')
-rw-r--r--src/nvim/testdir/test_edit.vim32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/nvim/testdir/test_edit.vim b/src/nvim/testdir/test_edit.vim
index eea5d190b2..e73ad80c2c 100644
--- a/src/nvim/testdir/test_edit.vim
+++ b/src/nvim/testdir/test_edit.vim
@@ -1141,26 +1141,36 @@ endfunc
func Test_edit_MOUSE()
" This is a simple test, since we not really using the mouse here
- if !has("mouse")
- return
- endif
+ CheckFeature mouse
10new
call setline(1, range(1, 100))
call cursor(1, 1)
+ call assert_equal(1, line('w0'))
+ call assert_equal(10, line('w$'))
set mouse=a
+ " One scroll event moves three lines.
call feedkeys("A\<ScrollWheelDown>\<esc>", 'tnix')
- call assert_equal([0, 4, 1, 0], getpos('.'))
- " This should move by one pageDown, but only moves
- " by one line when the test is run...
+ call assert_equal(4, line('w0'))
+ call assert_equal(13, line('w$'))
+ " This should move by one page down.
call feedkeys("A\<S-ScrollWheelDown>\<esc>", 'tnix')
- call assert_equal([0, 5, 1, 0], getpos('.'))
+ call assert_equal(14, line('w0'))
set nostartofline
+ " Another page down.
call feedkeys("A\<C-ScrollWheelDown>\<esc>", 'tnix')
- call assert_equal([0, 6, 1, 0], getpos('.'))
+ call assert_equal(24, line('w0'))
+
+ call assert_equal([0, 24, 2, 0], getpos('.'))
+ " call test_setmouse(4, 3)
+ call nvim_input_mouse('left', 'press', '', 0, 3, 2) " set mouse position
+ call getchar() " discard mouse event but keep mouse position
call feedkeys("A\<LeftMouse>\<esc>", 'tnix')
- call assert_equal([0, 6, 1, 0], getpos('.'))
- call feedkeys("A\<RightMouse>\<esc>", 'tnix')
- call assert_equal([0, 6, 1, 0], getpos('.'))
+ call assert_equal([0, 27, 2, 0], getpos('.'))
+ " call test_setmouse(5, 3)
+ call nvim_input_mouse('right', 'press', '', 0, 4, 2) " set mouse position
+ call getchar() " discard mouse event but keep mouse position
+ call feedkeys("A\<RightMouse>\<esc>\<esc>", 'tnix')
+ call assert_equal([0, 28, 2, 0], getpos('.'))
call cursor(1, 100)
norm! zt
" this should move by a screen up, but when the test