aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-04-28 17:09:40 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-04-28 17:55:41 +0800
commit0c5b03d83a6941e77bb5ffac561d1301cecccd1c (patch)
tree4a7f5f9ec642f5a41619a20b425f49a873c163d6
parentd8cc98caae1ec9cda033bfd487517e5a8f328c66 (diff)
downloadrneovim-0c5b03d83a6941e77bb5ffac561d1301cecccd1c.tar.gz
rneovim-0c5b03d83a6941e77bb5ffac561d1301cecccd1c.tar.bz2
rneovim-0c5b03d83a6941e77bb5ffac561d1301cecccd1c.zip
vim-patch:8.2.1108: mouse left-right scroll is not supported in terminal window
Problem: Mouse left-right scroll is not supported in terminal window. Solution: Implement mouse codes 6 and 7. (Trygve Aaberge, closes vim/vim#6363) https://github.com/vim/vim/commit/d58d4f90aeb381045000ea46493b5bd9b9d1fa23
-rw-r--r--test/old/testdir/mouse.vim12
-rw-r--r--test/old/testdir/test_termcodes.vim28
2 files changed, 37 insertions, 3 deletions
diff --git a/test/old/testdir/mouse.vim b/test/old/testdir/mouse.vim
index a3b0ddd008..dd2d6c465b 100644
--- a/test/old/testdir/mouse.vim
+++ b/test/old/testdir/mouse.vim
@@ -70,4 +70,16 @@ func MouseWheelDown(row, col)
call feedkeys('', 'x!')
endfunc
+func MouseWheelLeft(row, col)
+ call nvim_input_mouse('wheel', 'left', '', 0, a:row - 1, a:col - 1)
+ call getchar(1)
+ call feedkeys('', 'x!')
+endfunc
+
+func MouseWheelRight(row, col)
+ call nvim_input_mouse('wheel', 'right', '', 0, a:row - 1, a:col - 1)
+ call getchar(1)
+ call feedkeys('', 'x!')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/test/old/testdir/test_termcodes.vim b/test/old/testdir/test_termcodes.vim
index 4c65add5cf..b38bb2a51d 100644
--- a/test/old/testdir/test_termcodes.vim
+++ b/test/old/testdir/test_termcodes.vim
@@ -199,10 +199,11 @@ func Test_1xterm_mouse_wheel()
new
let save_mouse = &mouse
let save_term = &term
+ let save_wrap = &wrap
" let save_ttymouse = &ttymouse
- " set mouse=a term=xterm
- set mouse=a
- call setline(1, range(1, 100))
+ " set mouse=a term=xterm nowrap
+ set mouse=a nowrap
+ call setline(1, range(100000000000000, 100000000000100))
for ttymouse_val in g:Ttymouse_values
let msg = 'ttymouse=' .. ttymouse_val
@@ -226,10 +227,31 @@ func Test_1xterm_mouse_wheel()
call MouseWheelUp(1, 1)
call assert_equal(1, line('w0'), msg)
call assert_equal([0, 7, 1, 0], getpos('.'), msg)
+
+ if has('gui')
+ " Horizontal wheel scrolling currently only works when vim is
+ " compiled with gui enabled.
+ call MouseWheelRight(1, 1)
+ call assert_equal(7, 1 + virtcol(".") - wincol(), msg)
+ call assert_equal([0, 7, 7, 0], getpos('.'), msg)
+
+ call MouseWheelRight(1, 1)
+ call assert_equal(13, 1 + virtcol(".") - wincol(), msg)
+ call assert_equal([0, 7, 13, 0], getpos('.'), msg)
+
+ call MouseWheelLeft(1, 1)
+ call assert_equal(7, 1 + virtcol(".") - wincol(), msg)
+ call assert_equal([0, 7, 13, 0], getpos('.'), msg)
+
+ call MouseWheelLeft(1, 1)
+ call assert_equal(1, 1 + virtcol(".") - wincol(), msg)
+ call assert_equal([0, 7, 13, 0], getpos('.'), msg)
+ endif
endfor
let &mouse = save_mouse
" let &term = save_term
+ let &wrap = save_wrap
" let &ttymouse = save_ttymouse
bwipe!
endfunc