summaryrefslogtreecommitdiff
path: root/src/move.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/move.c')
-rw-r--r--src/move.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/move.c b/src/move.c
index e79ed726e..77f5cb92b 100644
--- a/src/move.c
+++ b/src/move.c
@@ -2171,6 +2171,7 @@ scroll_cursor_bot(int min_scroll, int set_topbot)
{
int used;
int scrolled = 0;
+ int min_scrolled = 1;
int extra = 0;
int i;
linenr_T line_count;
@@ -2236,6 +2237,10 @@ scroll_cursor_bot(int min_scroll, int set_topbot)
scrolled = used;
if (cln == curwin->w_botline)
scrolled -= curwin->w_empty_rows;
+ min_scrolled = scrolled;
+ if (cln > curwin->w_botline && curwin->w_p_sms && curwin->w_p_wrap)
+ for (linenr_T lnum = curwin->w_botline + 1; lnum <= cln; ++lnum)
+ min_scrolled += plines_nofill(lnum);
}
/*
@@ -2361,7 +2366,12 @@ scroll_cursor_bot(int min_scroll, int set_topbot)
if (line_count >= curwin->w_height && line_count > min_scroll)
scroll_cursor_halfway(FALSE);
else
+ {
+ // With 'smoothscroll' scroll at least the height of the cursor line.
+ if (curwin->w_p_wrap && curwin->w_p_sms && line_count < min_scrolled)
+ line_count = min_scrolled;
scrollup(line_count, TRUE);
+ }
/*
* If topline didn't change we need to restore w_botline and w_empty_rows