summaryrefslogtreecommitdiffstats
path: root/src/misc1.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/misc1.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/misc1.c')
-rw-r--r--src/misc1.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/misc1.c b/src/misc1.c
index c5a0c38527..8348488862 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -497,12 +497,17 @@ plines_win_col(win_T *wp, linenr_T lnum, long column)
return lines;
}
+/*
+ * Return number of window lines the physical line range from "first" until
+ * "last" will occupy in window "wp". Takes into account folding, 'wrap',
+ * topfill and filler lines beyond the end of the buffer. Limit to "max" lines.
+ */
int
-plines_m_win(win_T *wp, linenr_T first, linenr_T last, int limit_winheight)
+plines_m_win(win_T *wp, linenr_T first, linenr_T last, int max)
{
int count = 0;
- while (first <= last && (!limit_winheight || count < wp->w_height))
+ while (first <= last && count < max)
{
#ifdef FEAT_FOLDING
int x;
@@ -531,9 +536,7 @@ plines_m_win(win_T *wp, linenr_T first, linenr_T last, int limit_winheight)
if (first == wp->w_buffer->b_ml.ml_line_count + 1)
count += diff_check_fill(wp, first);
#endif
- if (limit_winheight && count > wp->w_height)
- return wp->w_height;
- return (count);
+ return MIN(max, count);
}
int