To: vim_dev@googlegroups.com Subject: Patch 8.1.1181 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1181 Problem: Tests for mouse clicks are a bit flaky when run in an interactive terminal. Solution: Use "xterm2" instead of "xterm" for 'ttymouse' to avoid spurious drag events. Files: src/testdir/test_termcodes.vim *** ../vim-8.1.1180/src/testdir/test_termcodes.vim 2019-04-17 16:33:42.795349446 +0200 --- src/testdir/test_termcodes.vim 2019-04-17 17:07:17.373210496 +0200 *************** *** 7,13 **** " Helper function to emit a terminal escape code. func TerminalEscapeCode(code_xterm, code_sgr, row, col, m) ! if &ttymouse ==# 'xterm' " need to use byte encoding here. let str = list2str([a:code_xterm, a:col + 0x20, a:row + 0x20]) if has('iconv') --- 7,13 ---- " Helper function to emit a terminal escape code. func TerminalEscapeCode(code_xterm, code_sgr, row, col, m) ! if &ttymouse ==# 'xterm2' " need to use byte encoding here. let str = list2str([a:code_xterm, a:col + 0x20, a:row + 0x20]) if has('iconv') *************** *** 50,56 **** set mouse=a term=xterm 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 --- 50,56 ---- set mouse=a term=xterm call setline(1, ['line 1', 'line 2', 'line 3 is a bit longer']) ! for ttymouse_val in ['xterm2', 'sgr'] let msg = 'ttymouse=' .. ttymouse_val exe 'set ttymouse=' . ttymouse_val go *************** *** 76,82 **** set mouse=a term=xterm call setline(1, range(1, 100)) ! for ttymouse_val in ['xterm', 'sgr'] let msg = 'ttymouse=' .. ttymouse_val exe 'set ttymouse=' . ttymouse_val go --- 76,82 ---- set mouse=a term=xterm call setline(1, range(1, 100)) ! for ttymouse_val in ['xterm2', 'sgr'] let msg = 'ttymouse=' .. ttymouse_val exe 'set ttymouse=' . ttymouse_val go *************** *** 112,118 **** let save_ttymouse = &ttymouse set mouse=a term=xterm ! for ttymouse_val in ['xterm', 'sgr'] let msg = 'ttymouse=' .. ttymouse_val exe 'set ttymouse=' . ttymouse_val --- 112,118 ---- 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 *************** *** 122,129 **** let row = rowseparator let col = 1 ! " When 'ttymouse' is 'xterm', row/col bigger than 223 are not supported. ! if ttymouse_val !=# 'xterm' || row <= 223 call MouseLeftClick(row, col) let row -= 1 call MouseLeftDrag(row, col) --- 122,129 ---- let row = rowseparator let col = 1 ! " When 'ttymouse' is 'xterm2', row/col bigger than 223 are not supported. ! if ttymouse_val !=# 'xterm2' || row <= 223 call MouseLeftClick(row, col) let row -= 1 call MouseLeftDrag(row, col) *************** *** 142,149 **** let row = 1 let col = colseparator ! " When 'ttymouse' is 'xterm', row/col bigger than 223 are not supported. ! if ttymouse_val !=# 'xterm' || col <= 223 call MouseLeftClick(row, col) let col -= 1 call MouseLeftDrag(row, col) --- 142,149 ---- let row = 1 let col = colseparator ! " When 'ttymouse' is 'xterm2', row/col bigger than 223 are not supported. ! if ttymouse_val !=# 'xterm2' || col <= 223 call MouseLeftClick(row, col) let col -= 1 call MouseLeftDrag(row, col) *************** *** 169,175 **** let save_laststatus = &laststatus set mouse=a term=xterm laststatus=2 ! for ttymouse_val in ['xterm', 'sgr'] let msg = 'ttymouse=' .. ttymouse_val exe 'set ttymouse=' . ttymouse_val --- 169,175 ---- let save_laststatus = &laststatus set mouse=a term=xterm laststatus=2 ! for ttymouse_val in ['xterm2', 'sgr'] let msg = 'ttymouse=' .. ttymouse_val exe 'set ttymouse=' . ttymouse_val *************** *** 178,185 **** let row = rowstatusline let col = 1 ! if ttymouse_val ==# 'xterm' && row > 223 ! " When 'ttymouse' is 'xterm', row/col bigger than 223 are not supported. continue endif --- 178,185 ---- let row = rowstatusline let col = 1 ! if ttymouse_val ==# 'xterm2' && row > 223 ! " When 'ttymouse' is 'xterm2', row/col bigger than 223 are not supported. continue endif *************** *** 210,216 **** set mouse=a term=xterm let row = 1 ! for ttymouse_val in ['xterm', 'sgr'] let msg = 'ttymouse=' .. ttymouse_val exe 'set ttymouse=' . ttymouse_val e Xfoo --- 210,216 ---- set mouse=a term=xterm let row = 1 ! for ttymouse_val in ['xterm2', 'sgr'] let msg = 'ttymouse=' .. ttymouse_val exe 'set ttymouse=' . ttymouse_val e Xfoo *************** *** 258,266 **** let row = 1 let col = &columns ! for ttymouse_val in ['xterm', 'sgr'] ! if ttymouse_val ==# 'xterm' && col > 223 ! " When 'ttymouse' is 'xterm', row/col bigger than 223 are not supported. continue endif let msg = 'ttymouse=' .. ttymouse_val --- 258,266 ---- let row = 1 let col = &columns ! for ttymouse_val in ['xterm2', 'sgr'] ! if ttymouse_val ==# 'xterm2' && col > 223 ! " When 'ttymouse' is 'xterm2', row/col bigger than 223 are not supported. continue endif let msg = 'ttymouse=' .. ttymouse_val *************** *** 304,310 **** set mouse=a term=xterm mousetime=1 let row = 1 ! for ttymouse_val in ['xterm', 'sgr'] let msg = 'ttymouse=' .. ttymouse_val exe 'set ttymouse=' . ttymouse_val e Xtab1 --- 304,310 ---- set mouse=a term=xterm mousetime=1 let row = 1 ! for ttymouse_val in ['xterm2', 'sgr'] let msg = 'ttymouse=' .. ttymouse_val exe 'set ttymouse=' . ttymouse_val e Xtab1 *************** *** 353,359 **** let row = 1 let col = 10 ! for ttymouse_val in ['xterm', 'sgr'] let msg = 'ttymouse=' .. ttymouse_val exe 'set ttymouse=' . ttymouse_val e Xtab1 --- 353,359 ---- let row = 1 let col = 10 ! for ttymouse_val in ['xterm2', 'sgr'] let msg = 'ttymouse=' .. ttymouse_val exe 'set ttymouse=' . ttymouse_val e Xtab1 *************** *** 402,408 **** let save_term = &term let save_ttymouse = &ttymouse let save_foldcolumn = &foldcolumn ! set mouse=a term=xterm foldcolumn=3 " Create 2 nested folds. call setline(1, range(1, 7)) --- 402,408 ---- let save_term = &term let save_ttymouse = &ttymouse let save_foldcolumn = &foldcolumn ! set mouse=a term=xterm foldcolumn=3 ttymouse=xterm2 " Create 2 nested folds. call setline(1, range(1, 7)) *** ../vim-8.1.1180/src/version.c 2019-04-17 16:53:44.925357857 +0200 --- src/version.c 2019-04-17 17:05:59.709607876 +0200 *************** *** 773,774 **** --- 773,776 ---- { /* Add new patch number below this line */ + /**/ + 1181, /**/ -- Life would be so much easier if we could just look at the source code. /// 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 ///