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>
diff --git a/src/move.c b/src/move.c
index 1b6e003..9bdd46f 100644
--- a/src/move.c
+++ b/src/move.c
@@ -1455,7 +1455,7 @@
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 @@
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;
}