mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 8.1.1216: mouse middle click is not tested
Problem: Mouse middle click is not tested. Solution: Add a test. (Dominique Pelle, closes #4310)
This commit is contained in:
@@ -26,10 +26,18 @@ func MouseLeftClick(row, col)
|
||||
call TerminalEscapeCode(0x20, 0, a:row, a:col, 'M')
|
||||
endfunc
|
||||
|
||||
func MouseMiddleClick(row, col)
|
||||
call TerminalEscapeCode(0x21, 1, a:row, a:col, 'M')
|
||||
endfunc
|
||||
|
||||
func MouseLeftRelease(row, col)
|
||||
call TerminalEscapeCode(0x23, 3, a:row, a:col, 'm')
|
||||
endfunc
|
||||
|
||||
func MouseMiddleRelease(row, col)
|
||||
call TerminalEscapeCode(0x23, 3, a:row, a:col, 'm')
|
||||
endfunc
|
||||
|
||||
func MouseLeftDrag(row, col)
|
||||
call TerminalEscapeCode(0x43, 0x20, a:row, a:col, 'M')
|
||||
endfunc
|
||||
@@ -42,7 +50,7 @@ func MouseWheelDown(row, col)
|
||||
call TerminalEscapeCode(0x41, 0x41, a:row, a:col, 'M')
|
||||
endfunc
|
||||
|
||||
func Test_xterm_mouse_click()
|
||||
func Test_xterm_mouse_left_click()
|
||||
new
|
||||
let save_mouse = &mouse
|
||||
let save_term = &term
|
||||
@@ -68,6 +76,48 @@ 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
|
||||
|
||||
for ttymouse_val in ['xterm2', '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
|
||||
|
@@ -767,6 +767,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1216,
|
||||
/**/
|
||||
1215,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user