Patch 8.2.4204
Problem: screenpos() has non-zero row for invisible text.
Solution: Only add the window row when the text is visible. (closes #9618)
Files: src/move.c, src/testdir/test_cursor_func.vim
*** ../vim-8.2.4203/src/move.c 2021-12-27 17:21:38.012449123 +0000
--- src/move.c 2022-01-24 16:09:44.165446424 +0000
***************
*** 1262,1273 ****
if (col >= wp->w_width)
col = -1;
if (col >= 0 && row + rowoff <= wp->w_height)
coloff = col - scol + wp->w_wincol + 1;
else
// character is left, right or below of the window
row = rowoff = scol = ccol = ecol = 0;
}
! *rowp = W_WINROW(wp) + row + rowoff;
*scolp = scol + coloff;
*ccolp = ccol + coloff;
*ecolp = ecol + coloff;
--- 1262,1276 ----
if (col >= wp->w_width)
col = -1;
if (col >= 0 && row + rowoff <= wp->w_height)
+ {
coloff = col - scol + wp->w_wincol + 1;
+ row += W_WINROW(wp);
+ }
else
// character is left, right or below of the window
row = rowoff = scol = ccol = ecol = 0;
}
! *rowp = row + rowoff;
*scolp = scol + coloff;
*ccolp = ccol + coloff;
*ecolp = ecol + coloff;
*** ../vim-8.2.4203/src/testdir/test_cursor_func.vim 2022-01-01
14:59:39.543684481 +0000
--- src/testdir/test_cursor_func.vim 2022-01-24 16:12:14.494469250 +0000
***************
*** 124,130 ****
\ 'col': wincol + 7,
\ 'curscol': wincol + 7,
\ 'endcol': wincol + 7}, winid->screenpos(line('$'), 8))
! call assert_equal({'row': winrow - 1, 'col': 0, 'curscol': 0, 'endcol': 0},
\ winid->screenpos(line('$'), 22))
close
--- 124,130 ----
\ 'col': wincol + 7,
\ 'curscol': wincol + 7,
\ 'endcol': wincol + 7}, winid->screenpos(line('$'), 8))
! call assert_equal({'row': 0, 'col': 0, 'curscol': 0, 'endcol': 0},
\ winid->screenpos(line('$'), 22))
close
*** ../vim-8.2.4203/src/version.c 2022-01-24 15:27:47.179058453 +0000
--- src/version.c 2022-01-24 16:10:55.188038188 +0000
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 4204,
/**/
--
The Law, in its majestic equality, forbids the rich, as well as the
poor, to sleep under the bridges, to beg in the streets, and to steal
bread. -- Anatole France
/// 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/20220124161546.C59A81C1AA3%40moolenaar.net.