diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2024-03-18 10:35:41 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-18 10:35:41 +0800 |
| commit | 9d315fb8b728355e8f1872f783b1ae9948e4fd9b (patch) | |
| tree | d29bafc234075e6b7c7e451d9667fb8808c71f1d /test | |
| parent | eabf9de1dc8c8eeb8246491a0e389b5f9a5fde97 (diff) | |
| download | rneovim-9d315fb8b728355e8f1872f783b1ae9948e4fd9b.tar.gz rneovim-9d315fb8b728355e8f1872f783b1ae9948e4fd9b.tar.bz2 rneovim-9d315fb8b728355e8f1872f783b1ae9948e4fd9b.zip | |
vim-patch:9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal (#27903)
Problem: Wrong cursor position when clicking after end of line with
'rightleft', 'virtualedit' and conceal.
Solution: Set values in ScreenCols[] also with SLF_RIGHTLEFT. Also fix
off-by-one cursor position with 'colorcolumn' (zeertzjq).
closes: vim/vim#14218
https://github.com/vim/vim/commit/deb2204bffa075ed5485415fc2dbd20e75d87ea4
Diffstat (limited to 'test')
| -rw-r--r-- | test/old/testdir/test_conceal.vim | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/old/testdir/test_conceal.vim b/test/old/testdir/test_conceal.vim index a03ec21e79..84b931f39d 100644 --- a/test/old/testdir/test_conceal.vim +++ b/test/old/testdir/test_conceal.vim @@ -462,6 +462,53 @@ func Test_conceal_mouse_click() call Ntest_setmouse(1, 32) call feedkeys("\<LeftMouse>", "tx") call assert_equal([0, 1, 24, 12, 36], getcurpos()) + " Behavior should also be the same with 'colorcolumn'. + setlocal colorcolumn=30 + redraw + call Ntest_setmouse(1, 31) + call feedkeys("\<LeftMouse>", "tx") + call assert_equal([0, 1, 24, 11, 35], getcurpos()) + call Ntest_setmouse(1, 32) + call feedkeys("\<LeftMouse>", "tx") + call assert_equal([0, 1, 24, 12, 36], getcurpos()) + setlocal colorcolumn& + + if has('rightleft') + setlocal rightleft + call assert_equal([ + \ ' ereh kcilc laecnoc', + \ ], ScreenLines(1, 40)) + " Click on the space between "this" and "click" puts cursor there. + call Ntest_setmouse(1, 41 - 9) + call feedkeys("\<LeftMouse>", "tx") + call assert_equal([0, 1, 13, 0, 13], getcurpos()) + " Click on 'h' of "here" puts cursor there. + call Ntest_setmouse(1, 41 - 16) + call feedkeys("\<LeftMouse>", "tx") + call assert_equal([0, 1, 20, 0, 20], getcurpos()) + " Click on 'e' of "here" puts cursor there. + call Ntest_setmouse(1, 41 - 19) + call feedkeys("\<LeftMouse>", "tx") + call assert_equal([0, 1, 23, 0, 23], getcurpos()) + " Click after end of line puts cursor there with 'virtualedit'. + call Ntest_setmouse(1, 41 - 20) + call feedkeys("\<LeftMouse>", "tx") + call assert_equal([0, 1, 24, 0, 24], getcurpos()) + call Ntest_setmouse(1, 41 - 21) + call feedkeys("\<LeftMouse>", "tx") + call assert_equal([0, 1, 24, 1, 25], getcurpos()) + call Ntest_setmouse(1, 41 - 22) + call feedkeys("\<LeftMouse>", "tx") + call assert_equal([0, 1, 24, 2, 26], getcurpos()) + call Ntest_setmouse(1, 41 - 31) + call feedkeys("\<LeftMouse>", "tx") + call assert_equal([0, 1, 24, 11, 35], getcurpos()) + call Ntest_setmouse(1, 41 - 32) + call feedkeys("\<LeftMouse>", "tx") + call assert_equal([0, 1, 24, 12, 36], getcurpos()) + setlocal rightleft& + endif + set virtualedit& " Test with a wrapped line. |