aboutsummaryrefslogtreecommitdiff
path: root/test/old/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-08-18 20:02:40 +0800
committerGitHub <noreply@github.com>2023-08-18 20:02:40 +0800
commitb9e75e575148b956190eb017bb1f6a492d6902ae (patch)
treedc596952a745fc70544f15b5751dff122a3392c7 /test/old/testdir
parent81d5550d77d24a924e8c23873fccbf405bc39447 (diff)
parent1d3d50e8f0e1c3438ad77a8727ad8d3f1333c79a (diff)
downloadrneovim-b9e75e575148b956190eb017bb1f6a492d6902ae.tar.gz
rneovim-b9e75e575148b956190eb017bb1f6a492d6902ae.tar.bz2
rneovim-b9e75e575148b956190eb017bb1f6a492d6902ae.zip
Merge pull request #24780 from zeertzjq/vim-9.0.0048
vim-patch:9.0.{0048,0177,1705,1725}: mouse click after concealed text
Diffstat (limited to 'test/old/testdir')
-rw-r--r--test/old/testdir/test_conceal.vim67
-rw-r--r--test/old/testdir/test_normal.vim43
-rw-r--r--test/old/testdir/test_virtualedit.vim6
3 files changed, 116 insertions, 0 deletions
diff --git a/test/old/testdir/test_conceal.vim b/test/old/testdir/test_conceal.vim
index 63e17d8f2f..0ec171aa2f 100644
--- a/test/old/testdir/test_conceal.vim
+++ b/test/old/testdir/test_conceal.vim
@@ -4,6 +4,7 @@ source check.vim
CheckFeature conceal
source screendump.vim
+source view_util.vim
func Test_conceal_two_windows()
CheckScreendump
@@ -334,4 +335,70 @@ func Test_conceal_eol()
set nolist
endfunc
+func Test_conceal_mouse_click()
+ enew!
+ set mouse=a
+ setlocal conceallevel=2 concealcursor=nc
+ syn match Concealed "this" conceal
+ hi link Concealed Search
+ call setline(1, 'conceal this click here')
+ redraw
+ call assert_equal(['conceal click here '], ScreenLines(1, 20))
+
+ " click on 'h' of "here" puts cursor there
+ call Ntest_setmouse(1, 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, 19)
+ call feedkeys("\<LeftMouse>", "tx")
+ call assert_equal([0, 1, 23, 0, 23], getcurpos())
+ " click after end of line puts cursor on 'e' without 'virtualedit'
+ call Ntest_setmouse(1, 20)
+ call feedkeys("\<LeftMouse>", "tx")
+ call assert_equal([0, 1, 23, 0, 24], getcurpos())
+ call Ntest_setmouse(1, 21)
+ call feedkeys("\<LeftMouse>", "tx")
+ call assert_equal([0, 1, 23, 0, 25], getcurpos())
+ call Ntest_setmouse(1, 22)
+ call feedkeys("\<LeftMouse>", "tx")
+ call assert_equal([0, 1, 23, 0, 26], getcurpos())
+ call Ntest_setmouse(1, 31)
+ call feedkeys("\<LeftMouse>", "tx")
+ call assert_equal([0, 1, 23, 0, 35], getcurpos())
+ call Ntest_setmouse(1, 32)
+ call feedkeys("\<LeftMouse>", "tx")
+ call assert_equal([0, 1, 23, 0, 36], getcurpos())
+
+ set virtualedit=all
+ redraw " Nvim: redraw_for_cursorcolumn() redraws for conceal
+ " click on 'h' of "here" puts cursor there
+ call Ntest_setmouse(1, 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, 19)
+ call feedkeys("\<LeftMouse>", "tx")
+ call assert_equal([0, 1, 23, 0, 23], getcurpos())
+ " click after end of line puts cursor there without 'virtualedit'
+ call Ntest_setmouse(1, 20)
+ call feedkeys("\<LeftMouse>", "tx")
+ call assert_equal([0, 1, 24, 0, 24], getcurpos())
+ call Ntest_setmouse(1, 21)
+ call feedkeys("\<LeftMouse>", "tx")
+ call assert_equal([0, 1, 24, 1, 25], getcurpos())
+ call Ntest_setmouse(1, 22)
+ call feedkeys("\<LeftMouse>", "tx")
+ call assert_equal([0, 1, 24, 2, 26], getcurpos())
+ 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())
+
+ bwipe!
+ set mouse& virtualedit&
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim
index c8e78dcf93..c022133b4f 100644
--- a/test/old/testdir/test_normal.vim
+++ b/test/old/testdir/test_normal.vim
@@ -4049,4 +4049,47 @@ func Test_normal_r_ctrl_v_cmd()
bw!
endfunc
+" Test clicking on a TAB or an unprintable character in Normal mode
+func Test_normal_click_on_ctrl_char()
+ let save_mouse = &mouse
+ set mouse=a
+ new
+
+ call setline(1, "a\<Tab>b\<C-K>c")
+ redraw
+ call Ntest_setmouse(1, 1)
+ call feedkeys("\<LeftMouse>", 'xt')
+ call assert_equal([0, 1, 1, 0, 1], getcurpos())
+ call Ntest_setmouse(1, 2)
+ call feedkeys("\<LeftMouse>", 'xt')
+ call assert_equal([0, 1, 2, 0, 2], getcurpos())
+ call Ntest_setmouse(1, 3)
+ call feedkeys("\<LeftMouse>", 'xt')
+ call assert_equal([0, 1, 2, 0, 3], getcurpos())
+ call Ntest_setmouse(1, 7)
+ call feedkeys("\<LeftMouse>", 'xt')
+ call assert_equal([0, 1, 2, 0, 7], getcurpos())
+ call Ntest_setmouse(1, 8)
+ call feedkeys("\<LeftMouse>", 'xt')
+ call assert_equal([0, 1, 2, 0, 8], getcurpos())
+ call Ntest_setmouse(1, 9)
+ call feedkeys("\<LeftMouse>", 'xt')
+ call assert_equal([0, 1, 3, 0, 9], getcurpos())
+ call Ntest_setmouse(1, 10)
+ call feedkeys("\<LeftMouse>", 'xt')
+ call assert_equal([0, 1, 4, 0, 10], getcurpos())
+ call Ntest_setmouse(1, 11)
+ call feedkeys("\<LeftMouse>", 'xt')
+ call assert_equal([0, 1, 4, 0, 11], getcurpos())
+ call Ntest_setmouse(1, 12)
+ call feedkeys("\<LeftMouse>", 'xt')
+ call assert_equal([0, 1, 5, 0, 12], getcurpos())
+ call Ntest_setmouse(1, 13)
+ call feedkeys("\<LeftMouse>", 'xt')
+ call assert_equal([0, 1, 5, 0, 13], getcurpos())
+
+ bwipe!
+ let &mouse = save_mouse
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/test/old/testdir/test_virtualedit.vim b/test/old/testdir/test_virtualedit.vim
index a2baf276ac..f97b3f987d 100644
--- a/test/old/testdir/test_virtualedit.vim
+++ b/test/old/testdir/test_virtualedit.vim
@@ -586,6 +586,12 @@ func Test_virtualedit_mouse()
call Ntest_setmouse(1, 9)
call feedkeys("\<LeftMouse>", "xt")
call assert_equal([0, 1, 6, 0, 9], getcurpos())
+ call Ntest_setmouse(1, 12)
+ call feedkeys("\<LeftMouse>", "xt")
+ call assert_equal([0, 1, 9, 0, 12], getcurpos())
+ call Ntest_setmouse(1, 13)
+ call feedkeys("\<LeftMouse>", "xt")
+ call assert_equal([0, 1, 10, 0, 13], getcurpos())
call Ntest_setmouse(1, 15)
call feedkeys("\<LeftMouse>", "xt")
call assert_equal([0, 1, 10, 2, 15], getcurpos())