Patch 8.1.2148

10 views
Skip to first unread message

Bram Moolenaar

unread,
Oct 13, 2019, 3:02:15 PM10/13/19
to vim...@googlegroups.com

Patch 8.1.2148
Problem: No test for right click extending Visual area.
Solution: Add a test. (Dominique Pelle, closes #5018)
Files: src/testdir/test_termcodes.vim


*** ../vim-8.1.2147/src/testdir/test_termcodes.vim 2019-10-13 16:43:35.960359646 +0200
--- src/testdir/test_termcodes.vim 2019-10-13 21:00:05.451052404 +0200
***************
*** 72,77 ****
--- 72,85 ----
endif
endfunc

+ func MouseRightClick(row, col)
+ if &ttymouse ==# 'dec'
+ call DecEscapeCode(6, 1, a:row, a:col)
+ else
+ call TerminalEscapeCode(2, a:row, a:col, 'M')
+ endif
+ endfunc
+
func MouseCtrlLeftClick(row, col)
let ctrl = 0x10
call TerminalEscapeCode(0 + ctrl, a:row, a:col, 'M')
***************
*** 101,107 ****
endfunc

func MouseRightRelease(row, col)
! call TerminalEscapeCode(3, a:row, a:col, 'm')
endfunc

func MouseLeftDrag(row, col)
--- 109,119 ----
endfunc

func MouseRightRelease(row, col)
! if &ttymouse ==# 'dec'
! call DecEscapeCode(7, 0, a:row, a:col)
! else
! call TerminalEscapeCode(3, a:row, a:col, 'm')
! endif
endfunc

func MouseLeftDrag(row, col)
***************
*** 142,147 ****
--- 154,232 ----
endfor

let &mouse = save_mouse
+ let &term = save_term
+ let &ttymouse = save_ttymouse
+ call test_override('no_query_mouse', 0)
+ bwipe!
+ endfunc
+
+ func Test_xterm_mouse_right_click_extends_visual()
+ if has('mac')
+ throw "Skipped: test right click in visual mode does not work on macOs (why?)"
+ endif
+ let save_mouse = &mouse
+ let save_term = &term
+ let save_ttymouse = &ttymouse
+ call test_override('no_query_mouse', 1)
+ set mouse=a term=xterm
+
+ for visual_mode in ["v", "V", "\<C-V>"]
+ for ttymouse_val in s:ttymouse_values + s:ttymouse_dec
+ let msg = 'visual=' .. visual_mode .. ' ttymouse=' .. ttymouse_val
+ exe 'set ttymouse=' .. ttymouse_val
+
+ call setline(1, repeat([repeat('-', 7)], 7))
+ call MouseLeftClick(4, 4)
+ call MouseLeftRelease(4, 4)
+ exe "norm! " .. visual_mode
+
+ " Right click extends top left of visual area.
+ call MouseRightClick(2, 2)
+ call MouseRightRelease(2, 2)
+
+ " Right click extends bottom bottom right of visual area.
+ call MouseRightClick(6, 6)
+ call MouseRightRelease(6, 6)
+ norm! r1gv
+
+ " Right click shrinks top left of visual area.
+ call MouseRightClick(3, 3)
+ call MouseRightRelease(3, 3)
+
+ " Right click shrinks bottom right of visual area.
+ call MouseRightClick(5, 5)
+ call MouseRightRelease(5, 5)
+ norm! r2
+
+ if visual_mode ==# 'v'
+ call assert_equal(['-------',
+ \ '-111111',
+ \ '1122222',
+ \ '2222222',
+ \ '2222211',
+ \ '111111-',
+ \ '-------'], getline(1, '$'), msg)
+ elseif visual_mode ==# 'V'
+ call assert_equal(['-------',
+ \ '1111111',
+ \ '2222222',
+ \ '2222222',
+ \ '2222222',
+ \ '1111111',
+ \ '-------'], getline(1, '$'), msg)
+ else
+ call assert_equal(['-------',
+ \ '-11111-',
+ \ '-12221-',
+ \ '-12221-',
+ \ '-12221-',
+ \ '-11111-',
+ \ '-------'], getline(1, '$'), msg)
+ endif
+ endfor
+ endfor
+
+ let &mouse = save_mouse
let &term = save_term
let &ttymouse = save_ttymouse
call test_override('no_query_mouse', 0)
*** ../vim-8.1.2147/src/version.c 2019-10-13 19:49:22.342551928 +0200
--- src/version.c 2019-10-13 21:00:58.894853517 +0200
***************
*** 755,756 ****
--- 755,758 ----
{ /* Add new patch number below this line */
+ /**/
+ 2148,
/**/

--
Snoring is prohibited unless all bedroom windows are closed and securely
locked.
[real standing law in Massachusetts, United States of America]

/// Bram Moolenaar -- Br...@Moolenaar.net -- 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 ///
Reply all
Reply to author
Forward
0 new messages