diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-04-28 14:25:01 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-04-28 16:43:27 +0800 |
commit | 458633071aa1120d82a2bbdc97555c78707629d9 (patch) | |
tree | d848fb0905fb120aaf70945d9abe2512b4aa4dc0 | |
parent | 2a84e20ff50073a88899ea5a6a8ec6a9cb8d6fc7 (diff) | |
download | rneovim-458633071aa1120d82a2bbdc97555c78707629d9.tar.gz rneovim-458633071aa1120d82a2bbdc97555c78707629d9.tar.bz2 rneovim-458633071aa1120d82a2bbdc97555c78707629d9.zip |
vim-patch:8.1.1244: no tests for CTRL-mouse-click
Problem: No tests for CTRL-mouse-click.
Solution: Add a few tests. (Dominique Pelle, closes vim/vim#4323)
https://github.com/vim/vim/commit/1ee36d6ff5bc51a1ecb5631c3e5bb632b5d1bcfc
Use usr_toc.txt instead of help.txt.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r-- | test/old/testdir/test_termcodes.vim | 54 |
1 files changed, 45 insertions, 9 deletions
diff --git a/test/old/testdir/test_termcodes.vim b/test/old/testdir/test_termcodes.vim index b94a4b80eb..3b26fac800 100644 --- a/test/old/testdir/test_termcodes.vim +++ b/test/old/testdir/test_termcodes.vim @@ -18,7 +18,7 @@ func Test_xterm_mouse_left_click() call setline(1, ['line 1', 'line 2', 'line 3 is a bit longer']) for ttymouse_val in ['sgr'] let msg = 'ttymouse=' .. ttymouse_val - " exe 'set ttymouse=' . ttymouse_val + " exe 'set ttymouse=' .. ttymouse_val go call assert_equal([0, 1, 1, 0], getpos('.'), msg) let row = 2 @@ -34,6 +34,42 @@ func Test_xterm_mouse_left_click() bwipe! endfunc +" Test that <C-LeftMouse> jumps to help tag and <C-RightMouse> jumps back. +func Test_xterm_mouse_ctrl_click() + let save_mouse = &mouse + let save_term = &term + " let save_ttymouse = &ttymouse + " set mouse=a term=xterm + set mouse=a + + for ttymouse_val in ['sgr'] + let msg = 'ttymouse=' .. ttymouse_val + " exe 'set ttymouse=' .. ttymouse_val + " help + help usr_toc.txt + /usr_02.txt + norm! zt + let row = 1 + let col = 1 + call MouseCtrlLeftClick(row, col) + call MouseLeftRelease(row, col) + call assert_match('usr_02.txt$', bufname('%'), msg) + call assert_equal('*usr_02.txt*', expand('<cWORD>')) + + call MouseCtrlRightClick(row, col) + call MouseLeftRelease(row, col) + " call assert_match('help.txt$', bufname('%'), msg) + call assert_match('usr_toc.txt$', bufname('%'), msg) + call assert_equal('|usr_02.txt|', expand('<cWORD>')) + + helpclose + endfor + + let &mouse = save_mouse + " let &term = save_term + " let &ttymouse = save_ttymouse +endfunc + func Test_xterm_mouse_middle_click() CheckFeature clipboard_working @@ -48,7 +84,7 @@ func Test_xterm_mouse_middle_click() for ttymouse_val in ['sgr'] let msg = 'ttymouse=' .. ttymouse_val - " exe 'set ttymouse=' . ttymouse_val + " exe 'set ttymouse=' .. ttymouse_val call setline(1, ['123456789', '123456789']) " Middle-click in the middle of the line pastes text where clicked. @@ -90,7 +126,7 @@ func Test_xterm_mouse_wheel() for ttymouse_val in ['sgr'] let msg = 'ttymouse=' .. ttymouse_val - " exe 'set ttymouse=' . ttymouse_val + " exe 'set ttymouse=' .. ttymouse_val go call assert_equal(1, line('w0'), msg) call assert_equal([0, 1, 1, 0], getpos('.'), msg) @@ -127,7 +163,7 @@ func Test_xterm_mouse_drag_window_separator() for ttymouse_val in ['sgr'] let msg = 'ttymouse=' .. ttymouse_val - " exe 'set ttymouse=' . ttymouse_val + " exe 'set ttymouse=' .. ttymouse_val " Split horizontally and test dragging the horizontal window separator. split @@ -185,7 +221,7 @@ func Test_xterm_mouse_drag_statusline() for ttymouse_val in ['sgr'] let msg = 'ttymouse=' .. ttymouse_val - " exe 'set ttymouse=' . ttymouse_val + " exe 'set ttymouse=' .. ttymouse_val call assert_equal(1, &cmdheight, msg) let rowstatusline = winheight(0) + 1 @@ -227,7 +263,7 @@ func Test_xterm_mouse_click_tab() for ttymouse_val in ['sgr'] let msg = 'ttymouse=' .. ttymouse_val - " exe 'set ttymouse=' . ttymouse_val + " exe 'set ttymouse=' .. ttymouse_val e Xfoo tabnew Xbar @@ -280,7 +316,7 @@ func Test_xterm_mouse_click_X_to_close_tab() continue endif let msg = 'ttymouse=' .. ttymouse_val - " exe 'set ttymouse=' . ttymouse_val + " exe 'set ttymouse=' .. ttymouse_val e Xtab1 tabnew Xtab2 tabnew Xtab3 @@ -323,7 +359,7 @@ func Test_xterm_mouse_drag_to_move_tab() for ttymouse_val in ['sgr'] let msg = 'ttymouse=' .. ttymouse_val - " exe 'set ttymouse=' . ttymouse_val + " exe 'set ttymouse=' .. ttymouse_val e Xtab1 tabnew Xtab2 @@ -373,7 +409,7 @@ func Test_xterm_mouse_double_click_to_create_tab() for ttymouse_val in ['sgr'] let msg = 'ttymouse=' .. ttymouse_val - " exe 'set ttymouse=' . ttymouse_val + " exe 'set ttymouse=' .. ttymouse_val e Xtab1 tabnew Xtab2 |