summaryrefslogtreecommitdiffstats
path: root/src/move.c
diff options
context:
space:
mode:
authorLuuk van Baal <luukvbaal@gmail.com>2024-04-28 16:24:02 +0200
committerChristian Brabandt <cb@256bit.org>2024-04-28 16:24:02 +0200
commit32d701f51b1ed2834071a2c5031a300936beda13 (patch)
treec1978e5254b508023cfbe87275f0a7e126768709 /src/move.c
parentf351fd82920427b33a160cab9fdbc35ac1deb681 (diff)
patch 9.1.0380: Calculating line height for unnecessary amount of linesv9.1.0380
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>
Diffstat (limited to 'src/move.c')
-rw-r--r--src/move.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/move.c b/src/move.c
index 1b6e003cc0..9bdd46f2cd 100644
--- a/src/move.c
+++ b/src/move.c
@@ -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;
}