Patch 8.2.3193
Problem: screenpos() is wrong when the last line is partially visible and
'display' is "lastline".
Solution: Also compute the position for a partially visible line.
(closes #8599)
Files: src/move.c, src/testdir/test_cursor_func.vim
*** ../vim-8.2.3192/src/move.c 2021-07-08 13:19:09.013465756 +0200
--- src/move.c 2021-07-21 17:40:34.958062365 +0200
***************
*** 1229,1235 ****
int rowoff = 0;
colnr_T coloff = 0;
! if (pos->lnum >= wp->w_topline && pos->lnum < wp->w_botline)
{
colnr_T off;
colnr_T col;
--- 1229,1235 ----
int rowoff = 0;
colnr_T coloff = 0;
! if (pos->lnum >= wp->w_topline && pos->lnum <= wp->w_botline)
{
colnr_T off;
colnr_T col;
***************
*** 1256,1266 ****
col -= wp->w_leftcol;
if (col >= wp->w_width)
col = -1;
! if (col >= 0)
coloff = col - scol + wp->w_wincol + 1;
else
! // character is left or right of the window
! row = scol = ccol = ecol = 0;
}
*rowp = W_WINROW(wp) + row + rowoff;
*scolp = scol + coloff;
--- 1256,1266 ----
col -= wp->w_leftcol;
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;
*** ../vim-8.2.3192/src/testdir/test_cursor_func.vim 2021-01-16 16:52:14.656334823 +0100
--- src/testdir/test_cursor_func.vim 2021-07-21 18:01:22.084882189 +0200
***************
*** 101,109 ****
--- 101,125 ----
\ 'col': wincol + 9,
\ 'curscol': wincol + 9,
\ 'endcol': wincol + 9}, screenpos(winid, 2, 22))
+
+ let wininfo = getwininfo(winid)[0]
+ call setline(3, ['x']->repeat(wininfo.height))
+ call setline(line('$') + 1, 'x'->repeat(wininfo.width * 3))
+ setlocal nonumber display=lastline so=0
+ exe "normal G\<C-Y>\<C-Y>"
+ redraw
+ call assert_equal({'row': winrow + wininfo.height - 1,
+ \ '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
call assert_equal({}, screenpos(999, 1, 1))
+
bwipe!
+ set display&
call assert_equal({'col': 1, 'row': 1, 'endcol': 1, 'curscol': 1}, screenpos(win_getid(), 1, 1))
nmenu WinBar.TEST :
*** ../vim-8.2.3192/src/version.c 2021-07-20 22:29:15.745365063 +0200
--- src/version.c 2021-07-21 18:03:10.268340455 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3193,
/**/
--
Some of the well known MS-Windows errors:
ESLEEP Operator fell asleep
ENOERR No error yet
EDOLLAR OS too expensive
EWINDOWS MS-Windows loaded, system in danger
/// 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 ///