aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-04-28 14:21:51 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-04-28 16:42:26 +0800
commitf6f96c972a3d79255be5cbed6706103a52d8d419 (patch)
treeec4f94075591dcd925ca99f06fbeeb2b129fbaa7
parent6f56d5317e1e2ffd3dd2febd7e392468bb58e47a (diff)
downloadrneovim-f6f96c972a3d79255be5cbed6706103a52d8d419.tar.gz
rneovim-f6f96c972a3d79255be5cbed6706103a52d8d419.tar.bz2
rneovim-f6f96c972a3d79255be5cbed6706103a52d8d419.zip
vim-patch:8.1.1216: mouse middle click is not tested
Problem: Mouse middle click is not tested. Solution: Add a test. (Dominique Pelle, closes vim/vim#4310) https://github.com/vim/vim/commit/c1b8160b44b43cca3acd7a47c1b85350cb648fe5 Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r--test/old/testdir/test_termcodes.vim45
1 files changed, 44 insertions, 1 deletions
diff --git a/test/old/testdir/test_termcodes.vim b/test/old/testdir/test_termcodes.vim
index d8b59ad8cc..d18197e65e 100644
--- a/test/old/testdir/test_termcodes.vim
+++ b/test/old/testdir/test_termcodes.vim
@@ -8,7 +8,7 @@ source mouse.vim
source view_util.vim
source term_util.vim
-func Test_xterm_mouse_click()
+func Test_xterm_mouse_left_click()
new
let save_mouse = &mouse
let save_term = &term
@@ -34,6 +34,49 @@ func Test_xterm_mouse_click()
bwipe!
endfunc
+func Test_xterm_mouse_middle_click()
+ new
+ let save_mouse = &mouse
+ let save_term = &term
+ " let save_ttymouse = &ttymouse
+ let save_quotestar = @*
+ let @* = 'abc'
+ " set mouse=a term=xterm
+ set mouse=a
+
+ for ttymouse_val in ['sgr']
+ let msg = '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.
+ let row = 1
+ let col = 6
+ call MouseMiddleClick(row, col)
+ call MouseMiddleRelease(row, col)
+ call assert_equal(['12345abc6789', '123456789'], getline(1, '$'), msg)
+
+ " Middle-click beyond end of the line pastes text at the end of the line.
+ let col = 20
+ call MouseMiddleClick(row, col)
+ call MouseMiddleRelease(row, col)
+ call assert_equal(['12345abc6789abc', '123456789'], getline(1, '$'), msg)
+
+ " Middle-click beyond the last line pastes in the last line.
+ let row = 5
+ let col = 3
+ call MouseMiddleClick(row, col)
+ call MouseMiddleRelease(row, col)
+ call assert_equal(['12345abc6789abc', '12abc3456789'], getline(1, '$'), msg)
+ endfor
+
+ let &mouse = save_mouse
+ " let &term = save_term
+ " let &ttymouse = save_ttymouse
+ let @* = save_quotestar
+ bwipe!
+endfunc
+
func Test_xterm_mouse_wheel()
new
let save_mouse = &mouse