diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2023-09-21 08:00:03 +0800 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2023-09-21 09:43:12 +0800 |
| commit | adb73772d9197a7fa6e9ee7a2e8874118e60844d (patch) | |
| tree | c5c2087188b5627c2fe1f31f37e068b644c481e2 /test/old | |
| parent | f094db0e5ccaddca2b5db05bf9545d55f3eededf (diff) | |
| download | rneovim-adb73772d9197a7fa6e9ee7a2e8874118e60844d.tar.gz rneovim-adb73772d9197a7fa6e9ee7a2e8874118e60844d.tar.bz2 rneovim-adb73772d9197a7fa6e9ee7a2e8874118e60844d.zip | |
vim-patch:9.0.1919: Wrong curswant when clicking on empty line or with vsplits
Problem: Wrong curswant when clicking on empty line or with vsplits.
Solution: Don't check for ScreenCols[] before the start of the window
and handle empty line properly.
closes: vim/vim#13132
https://github.com/vim/vim/commit/03cd697d635f1b0e7ffe21cf8244a8fb755f2ddb
Diffstat (limited to 'test/old')
| -rw-r--r-- | test/old/testdir/test_normal.vim | 33 | ||||
| -rw-r--r-- | test/old/testdir/test_virtualedit.vim | 23 |
2 files changed, 46 insertions, 10 deletions
diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim index 3c21041899..09d3f0432f 100644 --- a/test/old/testdir/test_normal.vim +++ b/test/old/testdir/test_normal.vim @@ -4107,6 +4107,39 @@ func Test_normal_click_on_double_width_char() let &mouse = save_mouse endfunc +func Test_normal_click_on_empty_line() + let save_mouse = &mouse + set mouse=a + botright new + call setline(1, ['', '', '']) + let row = win_screenpos(0)[0] + 2 + 20vsplit + redraw + + call Ntest_setmouse(row, 1) + call feedkeys("\<LeftMouse>", 'xt') + call assert_equal([0, 3, 1, 0, 1], getcurpos()) + call Ntest_setmouse(row, 2) + call feedkeys("\<LeftMouse>", 'xt') + call assert_equal([0, 3, 1, 0, 2], getcurpos()) + call Ntest_setmouse(row, 10) + call feedkeys("\<LeftMouse>", 'xt') + call assert_equal([0, 3, 1, 0, 10], getcurpos()) + + call Ntest_setmouse(row, 21 + 1) + call feedkeys("\<LeftMouse>", 'xt') + call assert_equal([0, 3, 1, 0, 1], getcurpos()) + call Ntest_setmouse(row, 21 + 2) + call feedkeys("\<LeftMouse>", 'xt') + call assert_equal([0, 3, 1, 0, 2], getcurpos()) + call Ntest_setmouse(row, 21 + 10) + call feedkeys("\<LeftMouse>", 'xt') + call assert_equal([0, 3, 1, 0, 10], getcurpos()) + + bwipe! + let &mouse = save_mouse +endfunc + func Test_normal33_g_cmd_nonblank() " Test that g<End> goes to the last non-blank char and g$ to the last " visible column diff --git a/test/old/testdir/test_virtualedit.vim b/test/old/testdir/test_virtualedit.vim index 6ff51e36fb..4c11fcd99e 100644 --- a/test/old/testdir/test_virtualedit.vim +++ b/test/old/testdir/test_virtualedit.vim @@ -564,35 +564,38 @@ func Test_virtualedit_mouse() let save_mouse = &mouse set mouse=a set virtualedit=all - new + botright new + let row = win_screenpos(0)[0] + 20vsplit + wincmd p call setline(1, ["text\tword"]) redraw - call Ntest_setmouse(1, 4) + call Ntest_setmouse(row, 21 + 4) call feedkeys("\<LeftMouse>", "xt") call assert_equal([0, 1, 4, 0, 4], getcurpos()) - call Ntest_setmouse(1, 5) + call Ntest_setmouse(row, 21 + 5) call feedkeys("\<LeftMouse>", "xt") call assert_equal([0, 1, 5, 0, 5], getcurpos()) - call Ntest_setmouse(1, 6) + call Ntest_setmouse(row, 21 + 6) call feedkeys("\<LeftMouse>", "xt") call assert_equal([0, 1, 5, 1, 6], getcurpos()) - call Ntest_setmouse(1, 7) + call Ntest_setmouse(row, 21 + 7) call feedkeys("\<LeftMouse>", "xt") call assert_equal([0, 1, 5, 2, 7], getcurpos()) - call Ntest_setmouse(1, 8) + call Ntest_setmouse(row, 21 + 8) call feedkeys("\<LeftMouse>", "xt") call assert_equal([0, 1, 5, 3, 8], getcurpos()) - call Ntest_setmouse(1, 9) + call Ntest_setmouse(row, 21 + 9) call feedkeys("\<LeftMouse>", "xt") call assert_equal([0, 1, 6, 0, 9], getcurpos()) - call Ntest_setmouse(1, 12) + call Ntest_setmouse(row, 21 + 12) call feedkeys("\<LeftMouse>", "xt") call assert_equal([0, 1, 9, 0, 12], getcurpos()) - call Ntest_setmouse(1, 13) + call Ntest_setmouse(row, 21 + 13) call feedkeys("\<LeftMouse>", "xt") call assert_equal([0, 1, 10, 0, 13], getcurpos()) - call Ntest_setmouse(1, 15) + call Ntest_setmouse(row, 21 + 15) call feedkeys("\<LeftMouse>", "xt") call assert_equal([0, 1, 10, 2, 15], getcurpos()) |