To: vim_dev@googlegroups.com Subject: Patch 9.0.0177 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0177 Problem: Cursor position wrong with 'virtualedit' and mouse click after end of the line. (Hermann Mayer) Solution: Do not use ScreenCols[] when 'virtualedit' is active. (closes #10868) Files: src/mouse.c, src/testdir/test_virtualedit.vim *** ../vim-9.0.0176/src/mouse.c 2022-08-03 15:48:28.030481646 +0100 --- src/mouse.c 2022-08-09 14:14:45.143726553 +0100 *************** *** 1967,1973 **** // Only use ScreenCols[] after the window was redrawn. Mainly matters // for tests, a user would not click before redrawing. ! if (curwin->w_redr_type <= VALID_NO_UPDATE) col_from_screen = ScreenCols[off]; #ifdef FEAT_FOLDING // Remember the character under the mouse, it might be a '-' or '+' in --- 1967,1974 ---- // Only use ScreenCols[] after the window was redrawn. Mainly matters // for tests, a user would not click before redrawing. ! // Do not use when 'virtualedit' is active. ! if (curwin->w_redr_type <= VALID_NO_UPDATE && !virtual_active()) col_from_screen = ScreenCols[off]; #ifdef FEAT_FOLDING // Remember the character under the mouse, it might be a '-' or '+' in *** ../vim-9.0.0176/src/testdir/test_virtualedit.vim 2021-08-03 17:22:12.000000000 +0100 --- src/testdir/test_virtualedit.vim 2022-08-09 14:19:17.691552657 +0100 *************** *** 537,540 **** --- 537,575 ---- set virtualedit& endfunc + func Test_virtualedit_mouse() + let save_mouse = &mouse + set mouse=a + set virtualedit=all + new + + call setline(1, ["text\tword"]) + redraw + call test_setmouse(1, 4) + call feedkeys("\", "xt") + call assert_equal([0, 1, 4, 0, 4], getcurpos()) + call test_setmouse(1, 5) + call feedkeys("\", "xt") + call assert_equal([0, 1, 5, 0, 5], getcurpos()) + call test_setmouse(1, 6) + call feedkeys("\", "xt") + call assert_equal([0, 1, 5, 1, 6], getcurpos()) + call test_setmouse(1, 7) + call feedkeys("\", "xt") + call assert_equal([0, 1, 5, 2, 7], getcurpos()) + call test_setmouse(1, 8) + call feedkeys("\", "xt") + call assert_equal([0, 1, 5, 3, 8], getcurpos()) + call test_setmouse(1, 9) + call feedkeys("\", "xt") + call assert_equal([0, 1, 6, 0, 9], getcurpos()) + call test_setmouse(1, 15) + call feedkeys("\", "xt") + call assert_equal([0, 1, 10, 2, 15], getcurpos()) + + bwipe! + let &mouse = save_mouse + set virtualedit& + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-9.0.0176/src/version.c 2022-08-09 12:53:09.911689930 +0100 --- src/version.c 2022-08-09 14:18:45.615571084 +0100 *************** *** 737,738 **** --- 737,740 ---- { /* Add new patch number below this line */ + /**/ + 177, /**/ -- ARTHUR: Right! Knights! Forward! ARTHUR leads a charge toward the castle. Various shots of them battling on, despite being hit by a variety of farm animals. "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/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///