To: vim_dev@googlegroups.com Subject: Patch 8.1.1216 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1216 Problem: Mouse middle click is not tested. Solution: Add a test. (Dominique Pelle, closes #4310) Files: src/testdir/test_termcodes.vim *** ../vim-8.1.1215/src/testdir/test_termcodes.vim 2019-04-17 17:08:22.896875152 +0200 --- src/testdir/test_termcodes.vim 2019-04-27 19:09:47.706543703 +0200 *************** *** 26,35 **** --- 26,43 ---- 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,48 **** call TerminalEscapeCode(0x41, 0x41, a:row, a:col, 'M') endfunc ! func Test_xterm_mouse_click() new let save_mouse = &mouse let save_term = &term --- 50,56 ---- call TerminalEscapeCode(0x41, 0x41, a:row, a:col, 'M') endfunc ! func Test_xterm_mouse_left_click() new let save_mouse = &mouse let save_term = &term *************** *** 68,73 **** --- 76,123 ---- 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 *** ../vim-8.1.1215/src/version.c 2019-04-27 18:32:27.821786738 +0200 --- src/version.c 2019-04-27 19:10:36.410304033 +0200 *************** *** 769,770 **** --- 769,772 ---- { /* Add new patch number below this line */ + /**/ + 1216, /**/ -- ARTHUR: Well, I AM king... DENNIS: Oh king, eh, very nice. An' how'd you get that, eh? By exploitin' the workers -- by 'angin' on to outdated imperialist dogma which perpetuates the economic an' social differences in our society! If there's ever going to be any progress-- The Quest for the Holy Grail (Monty Python) /// 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 ///