Patch 8.1.1244
Problem: No tests for CTRL-mouse-click.
Solution: Add a few tests. (Dominique Pelle, closes #4323)
Files: src/testdir/test_termcodes.vim
*** ../vim-8.1.1243/src/testdir/test_termcodes.vim 2019-04-28
13:00:08.627933382 +0200
--- src/testdir/test_termcodes.vim 2019-05-01 23:10:28.220053123 +0200
***************
*** 32,37 ****
--- 32,47 ----
call TerminalEscapeCode(0x21, 1, a:row, a:col, 'M')
endfunc
+ func MouseCtrlLeftClick(row, col)
+ let ctrl = 0x10
+ call TerminalEscapeCode(0x20 + ctrl, 0 + ctrl, a:row, a:col, 'M')
+ endfunc
+
+ func MouseCtrlRightClick(row, col)
+ let ctrl = 0x10
+ call TerminalEscapeCode(0x22 + ctrl, 2 + ctrl, a:row, a:col, 'M')
+ endfunc
+
func MouseLeftRelease(row, col)
call TerminalEscapeCode(0x23, 3, a:row, a:col, 'm')
endfunc
***************
*** 40,45 ****
--- 50,59 ----
call TerminalEscapeCode(0x23, 3, a:row, a:col, 'm')
endfunc
+ func MouseRightRelease(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
***************
*** 62,68 ****
for ttymouse_val in ['xterm2', 'sgr']
let msg = 'ttymouse=' .. ttymouse_val
! exe 'set ttymouse=' . ttymouse_val
go
call assert_equal([0, 1, 1, 0], getpos('.'), msg)
let row = 2
--- 76,82 ----
for ttymouse_val in ['xterm2', 'sgr']
let msg = 'ttymouse=' .. ttymouse_val
! exe 'set ttymouse=' .. ttymouse_val
go
call assert_equal([0, 1, 1, 0], getpos('.'), msg)
let row = 2
***************
*** 78,83 ****
--- 92,130 ----
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
+
+ for ttymouse_val in ['xterm2', 'sgr']
+ let msg = 'ttymouse=' .. ttymouse_val
+ exe 'set ttymouse=' .. ttymouse_val
+ help
+ /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_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()
if !WorkingClipboard()
throw 'Skipped: No working clipboard'
***************
*** 93,99 ****
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.
--- 140,146 ----
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.
***************
*** 134,140 ****
for ttymouse_val in ['xterm2', 'sgr']
let msg = '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)
--- 181,187 ----
for ttymouse_val in ['xterm2', 'sgr']
let msg = '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)
***************
*** 170,176 ****
for ttymouse_val in ['xterm2', 'sgr']
let msg = 'ttymouse=' .. ttymouse_val
! exe 'set ttymouse=' . ttymouse_val
" Split horizontally and test dragging the horizontal window separator.
split
--- 217,223 ----
for ttymouse_val in ['xterm2', 'sgr']
let msg = 'ttymouse=' .. ttymouse_val
! exe 'set ttymouse=' .. ttymouse_val
" Split horizontally and test dragging the horizontal window separator.
split
***************
*** 227,233 ****
for ttymouse_val in ['xterm2', 'sgr']
let msg = 'ttymouse=' .. ttymouse_val
! exe 'set ttymouse=' . ttymouse_val
call assert_equal(1, &cmdheight, msg)
let rowstatusline = winheight(0) + 1
--- 274,280 ----
for ttymouse_val in ['xterm2', 'sgr']
let msg = 'ttymouse=' .. ttymouse_val
! exe 'set ttymouse=' .. ttymouse_val
call assert_equal(1, &cmdheight, msg)
let rowstatusline = winheight(0) + 1
***************
*** 268,274 ****
for ttymouse_val in ['xterm2', 'sgr']
let msg = 'ttymouse=' .. ttymouse_val
! exe 'set ttymouse=' . ttymouse_val
e Xfoo
tabnew Xbar
--- 315,321 ----
for ttymouse_val in ['xterm2', 'sgr']
let msg = 'ttymouse=' .. ttymouse_val
! exe 'set ttymouse=' .. ttymouse_val
e Xfoo
tabnew Xbar
***************
*** 320,326 ****
continue
endif
let msg = 'ttymouse=' .. ttymouse_val
! exe 'set ttymouse=' . ttymouse_val
e Xtab1
tabnew Xtab2
tabnew Xtab3
--- 367,373 ----
continue
endif
let msg = 'ttymouse=' .. ttymouse_val
! exe 'set ttymouse=' .. ttymouse_val
e Xtab1
tabnew Xtab2
tabnew Xtab3
***************
*** 362,368 ****
for ttymouse_val in ['xterm2', 'sgr']
let msg = 'ttymouse=' .. ttymouse_val
! exe 'set ttymouse=' . ttymouse_val
e Xtab1
tabnew Xtab2
--- 409,415 ----
for ttymouse_val in ['xterm2', 'sgr']
let msg = 'ttymouse=' .. ttymouse_val
! exe 'set ttymouse=' .. ttymouse_val
e Xtab1
tabnew Xtab2
***************
*** 411,417 ****
for ttymouse_val in ['xterm2', 'sgr']
let msg = 'ttymouse=' .. ttymouse_val
! exe 'set ttymouse=' . ttymouse_val
e Xtab1
tabnew Xtab2
--- 458,464 ----
for ttymouse_val in ['xterm2', 'sgr']
let msg = 'ttymouse=' .. ttymouse_val
! exe 'set ttymouse=' .. ttymouse_val
e Xtab1
tabnew Xtab2
*** ../vim-8.1.1243/src/version.c 2019-05-01 21:43:39.076257243 +0200
--- src/version.c 2019-05-01 23:13:24.447121682 +0200
***************
*** 769,770 ****
--- 769,772 ----
{ /* Add new patch number below this line */
+ /**/
+ 1244,
/**/
--
ARTHUR: Ni!
BEDEVERE: Nu!
ARTHUR: No. Ni! More like this. "Ni"!
BEDEVERE: Ni, ni, ni!
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.