1
0
forked from aniani/vim

patch 9.1.0380: Calculating line height for unnecessary amount of lines

Problem:  Calculating line height for unnecessary amount of lines with
          half-page scrolling (zhscn, after 9.1.0280)
Solution: Replace "limit_winheight" argument with higher resolution
          "max" argument to which to limit the calculated line height
          in plines_m_win() to (Luuk van Baal)

fixes: #14650
closes: #14652

Signed-off-by: Luuk van Baal <luukvbaal@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Luuk van Baal
2024-04-28 16:24:02 +02:00
committed by Christian Brabandt
parent f351fd8292
commit 32d701f51b
6 changed files with 24 additions and 13 deletions

View File

@@ -1455,7 +1455,7 @@ textpos2screenpos(
is_folded = hasFoldingWin(wp, lnum, &lnum, NULL, TRUE, NULL);
#endif
row = plines_m_win(wp, wp->w_topline, lnum - 1, FALSE);
row = plines_m_win(wp, wp->w_topline, lnum - 1, INT_MAX);
// "row" should be the screen line where line "lnum" begins, which can
// be negative if "lnum" is "w_topline" and "w_skipcol" is non-zero.
row -= adjust_plines_for_skipcol(wp);
@@ -3219,12 +3219,18 @@ pagescroll(int dir, long count, int half)
int curscount = count;
// Adjust count so as to not reveal end of buffer lines.
if (dir == FORWARD)
if (dir == FORWARD
&& (curwin->w_topline + curwin->w_height + count > buflen
#ifdef FEAT_FOLDING
|| hasAnyFolding(curwin)
#endif
))
{
int n = plines_correct_topline(curwin, curwin->w_topline, FALSE);
if (n - count < curwin->w_height && curwin->w_topline < buflen)
n += plines_m_win(curwin, curwin->w_topline + 1, buflen, FALSE);
if (n - count < curwin->w_height)
n += plines_m_win(curwin, curwin->w_topline + 1, buflen,
curwin->w_height + count);
if (n < curwin->w_height + count)
count = n - curwin->w_height;
}