To: vim_dev@googlegroups.com Subject: Patch 8.2.4568 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4568 Problem: getmousepos() does not compute the column below the last line. Solution: Also compute the column when the mouse is below the last line. (Sean Dewar, closes #9946) Files: src/mouse.c, src/testdir/test_functions.vim *** ../vim-8.2.4567/src/mouse.c 2022-03-13 19:08:44.685537723 +0000 --- src/mouse.c 2022-03-15 09:40:45.194237569 +0000 *************** *** 3099,3106 **** col -= left_off; if (row >= 0 && row < wp->w_height && col >= 0 && col < wp->w_width) { ! if (!mouse_comp_pos(wp, &row, &col, &lnum, NULL)) ! col = vcol2col(wp, lnum, col); column = col + 1; } } --- 3099,3106 ---- col -= left_off; if (row >= 0 && row < wp->w_height && col >= 0 && col < wp->w_width) { ! (void)mouse_comp_pos(wp, &row, &col, &lnum, NULL); ! col = vcol2col(wp, lnum, col); column = col + 1; } } *** ../vim-8.2.4567/src/testdir/test_functions.vim 2022-03-13 15:52:34.173429915 +0000 --- src/testdir/test_functions.vim 2022-03-15 09:40:27.914293988 +0000 *************** *** 2783,2788 **** --- 2783,2811 ---- \ line: 1, \ column: 8, \ }, getmousepos()) + + " If the mouse is positioned past the last buffer line, "line" and "column" + " should act like it's positioned on the last buffer line. + call test_setmouse(2, 25) + call assert_equal(#{ + \ screenrow: 2, + \ screencol: 25, + \ winid: win_getid(), + \ winrow: 2, + \ wincol: 25, + \ line: 1, + \ column: 4, + \ }, getmousepos()) + call test_setmouse(2, 50) + call assert_equal(#{ + \ screenrow: 2, + \ screencol: 50, + \ winid: win_getid(), + \ winrow: 2, + \ wincol: 50, + \ line: 1, + \ column: 8, + \ }, getmousepos()) bwipe! endfunc *** ../vim-8.2.4567/src/version.c 2022-03-14 20:46:37.461884474 +0000 --- src/version.c 2022-03-15 09:45:04.625396409 +0000 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 4568, /**/ -- hundred-and-one symptoms of being an internet addict: 265. Your reason for not staying in touch with family is that they do not have e-mail addresses. /// 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 ///