mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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)
d58d4f90ae
This commit is contained in:
parent
d8cc98caae
commit
0c5b03d83a
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user