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 -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220315094737.187D31C45E0%40moolenaar.net.