To: vim_dev@googlegroups.com Subject: Patch 8.1.1178 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1178 Problem: When mouse click tests fails value of 'ttytype' is unknown. Solution: Add a message to the assert. Files: src/testdir/test_termcodes.vim *** ../vim-8.1.1177/src/testdir/test_termcodes.vim 2019-04-15 21:48:19.463316793 +0200 --- src/testdir/test_termcodes.vim 2019-04-17 16:24:40.278144677 +0200 *************** *** 51,64 **** call setline(1, ['line 1', 'line 2', 'line 3 is a bit longer']) for ttymouse_val in ['xterm', 'sgr'] exe 'set ttymouse=' . ttymouse_val go ! call assert_equal([0, 1, 1, 0], getpos('.')) let row = 2 let col = 6 call MouseLeftClick(row, col) call MouseLeftRelease(row, col) ! call assert_equal([0, 2, 6, 0], getpos('.')) endfor let &mouse = save_mouse --- 51,65 ---- call setline(1, ['line 1', 'line 2', 'line 3 is a bit longer']) for ttymouse_val in ['xterm', 'sgr'] + let msg = 'ttymouse=' .. ttymouse_val exe 'set ttymouse=' . ttymouse_val go ! call assert_equal([0, 1, 1, 0], getpos('.'), msg) let row = 2 let col = 6 call MouseLeftClick(row, col) call MouseLeftRelease(row, col) ! call assert_equal([0, 2, 6, 0], getpos('.'), msg) endfor let &mouse = save_mouse *************** *** 76,101 **** call setline(1, range(1, 100)) for ttymouse_val in ['xterm', 'sgr'] exe 'set ttymouse=' . ttymouse_val go ! call assert_equal(1, line('w0')) ! call assert_equal([0, 1, 1, 0], getpos('.')) call MouseWheelDown(1, 1) ! call assert_equal(4, line('w0')) ! call assert_equal([0, 4, 1, 0], getpos('.')) call MouseWheelDown(1, 1) ! call assert_equal(7, line('w0')) ! call assert_equal([0, 7, 1, 0], getpos('.')) call MouseWheelUp(1, 1) ! call assert_equal(4, line('w0')) ! call assert_equal([0, 7, 1, 0], getpos('.')) call MouseWheelUp(1, 1) ! call assert_equal(1, line('w0')) ! call assert_equal([0, 7, 1, 0], getpos('.')) endfor let &mouse = save_mouse --- 77,103 ---- call setline(1, range(1, 100)) for ttymouse_val in ['xterm', '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) call MouseWheelDown(1, 1) ! call assert_equal(4, line('w0'), msg) ! call assert_equal([0, 4, 1, 0], getpos('.'), msg) call MouseWheelDown(1, 1) ! call assert_equal(7, line('w0'), msg) ! call assert_equal([0, 7, 1, 0], getpos('.'), msg) call MouseWheelUp(1, 1) ! call assert_equal(4, line('w0'), msg) ! call assert_equal([0, 7, 1, 0], getpos('.'), msg) call MouseWheelUp(1, 1) ! call assert_equal(1, line('w0'), msg) ! call assert_equal([0, 7, 1, 0], getpos('.'), msg) endfor let &mouse = save_mouse *************** *** 111,116 **** --- 113,119 ---- set mouse=a term=xterm for ttymouse_val in ['xterm', 'sgr'] + let msg = 'ttymouse=' .. ttymouse_val exe 'set ttymouse=' . ttymouse_val " Split horizontally and test dragging the horizontal window separator. *************** *** 124,135 **** call MouseLeftClick(row, col) let row -= 1 call MouseLeftDrag(row, col) ! call assert_equal(rowseparator - 1, winheight(0) + 1) let row += 1 call MouseLeftDrag(row, col) ! call assert_equal(rowseparator, winheight(0) + 1) call MouseLeftRelease(row, col) ! call assert_equal(rowseparator, winheight(0) + 1) endif bwipe! --- 127,138 ---- call MouseLeftClick(row, col) let row -= 1 call MouseLeftDrag(row, col) ! call assert_equal(rowseparator - 1, winheight(0) + 1, msg) let row += 1 call MouseLeftDrag(row, col) ! call assert_equal(rowseparator, winheight(0) + 1, msg) call MouseLeftRelease(row, col) ! call assert_equal(rowseparator, winheight(0) + 1, msg) endif bwipe! *************** *** 144,155 **** call MouseLeftClick(row, col) let col -= 1 call MouseLeftDrag(row, col) ! call assert_equal(colseparator - 1, winwidth(0) + 1) let col += 1 call MouseLeftDrag(row, col) ! call assert_equal(colseparator, winwidth(0) + 1) call MouseLeftRelease(row, col) ! call assert_equal(colseparator, winwidth(0) + 1) endif bwipe! endfor --- 147,158 ---- call MouseLeftClick(row, col) let col -= 1 call MouseLeftDrag(row, col) ! call assert_equal(colseparator - 1, winwidth(0) + 1, msg) let col += 1 call MouseLeftDrag(row, col) ! call assert_equal(colseparator, winwidth(0) + 1, msg) call MouseLeftRelease(row, col) ! call assert_equal(colseparator, winwidth(0) + 1, msg) endif bwipe! endfor *************** *** 167,175 **** set mouse=a term=xterm laststatus=2 for ttymouse_val in ['xterm', 'sgr'] exe 'set ttymouse=' . ttymouse_val ! call assert_equal(1, &cmdheight) let rowstatusline = winheight(0) + 1 let row = rowstatusline let col = 1 --- 170,179 ---- set mouse=a term=xterm laststatus=2 for ttymouse_val in ['xterm', 'sgr'] + let msg = 'ttymouse=' .. ttymouse_val exe 'set ttymouse=' . ttymouse_val ! call assert_equal(1, &cmdheight, msg) let rowstatusline = winheight(0) + 1 let row = rowstatusline let col = 1 *************** *** 182,196 **** call MouseLeftClick(row, col) let row -= 1 call MouseLeftDrag(row, col) ! call assert_equal(2, &cmdheight) ! call assert_equal(rowstatusline - 1, winheight(0) + 1) let row += 1 call MouseLeftDrag(row, col) ! call assert_equal(1, &cmdheight) ! call assert_equal(rowstatusline, winheight(0) + 1) call MouseLeftRelease(row, col) ! call assert_equal(1, &cmdheight) ! call assert_equal(rowstatusline, winheight(0) + 1) endfor let &mouse = save_mouse --- 186,200 ---- call MouseLeftClick(row, col) let row -= 1 call MouseLeftDrag(row, col) ! call assert_equal(2, &cmdheight, msg) ! call assert_equal(rowstatusline - 1, winheight(0) + 1, msg) let row += 1 call MouseLeftDrag(row, col) ! call assert_equal(1, &cmdheight, msg) ! call assert_equal(rowstatusline, winheight(0) + 1, msg) call MouseLeftRelease(row, col) ! call assert_equal(1, &cmdheight, msg) ! call assert_equal(rowstatusline, winheight(0) + 1, msg) endfor let &mouse = save_mouse *************** *** 207,212 **** --- 211,217 ---- let row = 1 for ttymouse_val in ['xterm', 'sgr'] + let msg = 'ttymouse=' .. ttymouse_val exe 'set ttymouse=' . ttymouse_val e Xfoo tabnew Xbar *************** *** 215,221 **** call assert_equal(['Tab page 1', \ ' Xfoo', \ 'Tab page 2', ! \ '> Xbar'], a) " Test clicking on tab names in the tabline at the top. let col = 2 --- 220,226 ---- call assert_equal(['Tab page 1', \ ' Xfoo', \ 'Tab page 2', ! \ '> Xbar'], a, msg) " Test clicking on tab names in the tabline at the top. let col = 2 *************** *** 226,232 **** call assert_equal(['Tab page 1', \ '> Xfoo', \ 'Tab page 2', ! \ ' Xbar'], a) let col = 9 call MouseLeftClick(row, col) --- 231,237 ---- call assert_equal(['Tab page 1', \ '> Xfoo', \ 'Tab page 2', ! \ ' Xbar'], a, msg) let col = 9 call MouseLeftClick(row, col) *************** *** 235,241 **** call assert_equal(['Tab page 1', \ ' Xfoo', \ 'Tab page 2', ! \ '> Xbar'], a) %bwipe! endfor --- 240,246 ---- call assert_equal(['Tab page 1', \ ' Xfoo', \ 'Tab page 2', ! \ '> Xbar'], a, msg) %bwipe! endfor *************** *** 258,263 **** --- 263,269 ---- " When 'ttymouse' is 'xterm', row/col bigger than 223 are not supported. continue endif + let msg = 'ttymouse=' .. ttymouse_val exe 'set ttymouse=' . ttymouse_val e Xtab1 tabnew Xtab2 *************** *** 270,276 **** \ 'Tab page 2', \ '> Xtab2', \ 'Tab page 3', ! \ ' Xtab3'], a) " Click on "X" in tabline to close current tab i.e. Xtab2. redraw --- 276,282 ---- \ 'Tab page 2', \ '> Xtab2', \ 'Tab page 3', ! \ ' Xtab3'], a, msg) " Click on "X" in tabline to close current tab i.e. Xtab2. redraw *************** *** 280,286 **** call assert_equal(['Tab page 1', \ ' Xtab1', \ 'Tab page 2', ! \ '> Xtab3'], a) %bwipe! endfor --- 286,292 ---- call assert_equal(['Tab page 1', \ ' Xtab1', \ 'Tab page 2', ! \ '> Xtab3'], a, msg) %bwipe! endfor *************** *** 299,304 **** --- 305,311 ---- let row = 1 for ttymouse_val in ['xterm', 'sgr'] + let msg = 'ttymouse=' .. ttymouse_val exe 'set ttymouse=' . ttymouse_val e Xtab1 tabnew Xtab2 *************** *** 307,320 **** call assert_equal(['Tab page 1', \ ' Xtab1', \ 'Tab page 2', ! \ '> Xtab2'], a) redraw " Click in tab2 and drag it to tab1. " Check getcharmod() to verify that click is not " interpreted as a spurious double-click. call MouseLeftClick(row, 10) ! call assert_equal(0, getcharmod()) for col in [9, 8, 7, 6] call MouseLeftDrag(row, col) endfor --- 314,327 ---- call assert_equal(['Tab page 1', \ ' Xtab1', \ 'Tab page 2', ! \ '> Xtab2'], a, msg) redraw " Click in tab2 and drag it to tab1. " Check getcharmod() to verify that click is not " interpreted as a spurious double-click. call MouseLeftClick(row, 10) ! call assert_equal(0, getcharmod(), msg) for col in [9, 8, 7, 6] call MouseLeftDrag(row, col) endfor *************** *** 323,329 **** call assert_equal(['Tab page 1', \ '> Xtab2', \ 'Tab page 2', ! \ ' Xtab1'], a) " brief sleep to avoid causing a double-click sleep 20m --- 330,336 ---- call assert_equal(['Tab page 1', \ '> Xtab2', \ 'Tab page 2', ! \ ' Xtab1'], a, msg) " brief sleep to avoid causing a double-click sleep 20m *************** *** 347,352 **** --- 354,360 ---- let col = 10 for ttymouse_val in ['xterm', 'sgr'] + let msg = 'ttymouse=' .. ttymouse_val exe 'set ttymouse=' . ttymouse_val e Xtab1 tabnew Xtab2 *************** *** 355,370 **** call assert_equal(['Tab page 1', \ ' Xtab1', \ 'Tab page 2', ! \ '> Xtab2'], a) redraw call MouseLeftClick(row, col) " Check getcharmod() to verify that first click is not " interpreted as a spurious double-click. ! call assert_equal(0, getcharmod()) call MouseLeftRelease(row, col) call MouseLeftClick(row, col) ! call assert_equal(32, getcharmod()) " double-click call MouseLeftRelease(row, col) let a = split(execute(':tabs'), "\n") call assert_equal(['Tab page 1', --- 363,378 ---- call assert_equal(['Tab page 1', \ ' Xtab1', \ 'Tab page 2', ! \ '> Xtab2'], a, msg) redraw call MouseLeftClick(row, col) " Check getcharmod() to verify that first click is not " interpreted as a spurious double-click. ! call assert_equal(0, getcharmod(), msg) call MouseLeftRelease(row, col) call MouseLeftClick(row, col) ! call assert_equal(32, getcharmod(), msg) " double-click call MouseLeftRelease(row, col) let a = split(execute(':tabs'), "\n") call assert_equal(['Tab page 1', *************** *** 372,378 **** \ 'Tab page 2', \ '> [No Name]', \ 'Tab page 3', ! \ ' Xtab2'], a) if ttymouse_val !=# 'sgr' " We need to sleep, or else MouseLeftClick() in next loop --- 380,386 ---- \ 'Tab page 2', \ '> [No Name]', \ 'Tab page 3', ! \ ' Xtab2'], a, msg) if ttymouse_val !=# 'sgr' " We need to sleep, or else MouseLeftClick() in next loop *** ../vim-8.1.1177/src/version.c 2019-04-16 22:21:00.042595439 +0200 --- src/version.c 2019-04-17 16:26:22.281621305 +0200 *************** *** 773,774 **** --- 773,776 ---- { /* Add new patch number below this line */ + /**/ + 1178, /**/ -- He was not in the least bit scared to be mashed into a pulp Or to have his eyes gouged out and his elbows broken; To have his kneecaps split and his body burned away And his limbs all hacked and mangled, brave Sir Robin. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@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 ///