diff options
Diffstat (limited to 'src/nvim/plines.c')
-rw-r--r-- | src/nvim/plines.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/plines.c b/src/nvim/plines.c index 8734780415..0c55e2fd72 100644 --- a/src/nvim/plines.c +++ b/src/nvim/plines.c @@ -880,14 +880,17 @@ int plines_m_win(win_T *wp, linenr_T first, linenr_T last, bool limit_winheight) { int count = 0; - while (first <= last) { + while (first <= last && (!limit_winheight || count < wp->w_height_inner)) { linenr_T next = first; - count += plines_win_full(wp, first, &next, NULL, false, limit_winheight); + count += plines_win_full(wp, first, &next, NULL, false, false); first = next + 1; } if (first == wp->w_buffer->b_ml.ml_line_count + 1) { count += win_get_fill(wp, first); } + if (limit_winheight && count > wp->w_height_inner) { + return wp->w_height_inner; + } return count; } |