Patch 9.0.1072
Problem: screenpos() column result in fold may be too small.
Solution: Add space of 'number', sign column, etc. (closes #11715)
Files: src/move.c, src/testdir/test_cursor_func.vim
*** ../vim-9.0.1071/src/move.c 2022-12-05 22:26:40.255110186 +0000
--- src/move.c 2022-12-18 12:28:25.966350301 +0000
***************
*** 1416,1422 ****
if (pos->lnum >= wp->w_topline && pos->lnum <= wp->w_botline)
{
- colnr_T off;
colnr_T col;
int width;
linenr_T lnum = pos->lnum;
--- 1416,1421 ----
***************
*** 1432,1442 ****
row += diff_check_fill(wp, lnum);
#endif
#ifdef FEAT_FOLDING
if (is_folded)
{
row += W_WINROW(wp);
! coloff = wp->w_wincol + 1;
}
else
#endif
--- 1431,1442 ----
row += diff_check_fill(wp, lnum);
#endif
+ colnr_T off = win_col_off(wp);
#ifdef FEAT_FOLDING
if (is_folded)
{
row += W_WINROW(wp);
! coloff = wp->w_wincol + 1 + off;
}
else
#endif
***************
*** 1445,1451 ****
// similar to what is done in validate_cursor_col()
col = scol;
- off = win_col_off(wp);
col += off;
width = wp->w_width - off + win_col_off2(wp);
--- 1445,1450 ----
*** ../vim-9.0.1071/src/testdir/test_cursor_func.vim 2022-12-05 22:26:40.259110192 +0000
--- src/testdir/test_cursor_func.vim 2022-12-18 12:13:08.735443175 +0000
***************
*** 150,157 ****
redraw
call assert_equal(2, screenpos(1, 2, 1).row)
call assert_equal(#{col: 1, row: 3, endcol: 1, curscol: 1}, screenpos(1, 3, 1))
! call assert_equal(3, screenpos(1, 4, 1).row)
! call assert_equal(3, screenpos(1, 5, 1).row)
call assert_equal(4, screenpos(1, 6, 1).row)
bwipe!
endfunc
--- 150,161 ----
redraw
call assert_equal(2, screenpos(1, 2, 1).row)
call assert_equal(#{col: 1, row: 3, endcol: 1, curscol: 1}, screenpos(1, 3, 1))
! call assert_equal(#{col: 1, row: 3, endcol: 1, curscol: 1}, screenpos(1, 4, 1))
! call assert_equal(#{col: 1, row: 3, endcol: 1, curscol: 1}, screenpos(1, 5, 1))
! setlocal number
! call assert_equal(#{col: 5, row: 3, endcol: 5, curscol: 5}, screenpos(1, 3, 1))
! call assert_equal(#{col: 5, row: 3, endcol: 5, curscol: 5}, screenpos(1, 4, 1))
! call assert_equal(#{col: 5, row: 3, endcol: 5, curscol: 5}, screenpos(1, 5, 1))
call assert_equal(4, screenpos(1, 6, 1).row)
bwipe!
endfunc
*** ../vim-9.0.1071/src/version.c 2022-12-17 15:47:41.398038024 +0000
--- src/version.c 2022-12-18 12:15:46.843246042 +0000
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 1072,
/**/
--
ARTHUR: Will you ask your master if he wants to join my court at Camelot?!
GUARD #1: But then of course African swallows are not migratory.
GUARD #2: Oh, yeah...
GUARD #1: So they couldn't bring a coconut back anyway...
The Quest for the Holy Grail (Monty Python)
/// Bram Moolenaar -- Br...@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 ///