aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/normal.c
diff options
context:
space:
mode:
authorRom Grk <romgrk.cc@gmail.com>2020-10-25 02:25:22 -0400
committerRom Grk <romgrk.cc@gmail.com>2020-10-25 02:25:22 -0400
commitd2a38dab8085ddb973393ca7f077ff65d64f60ef (patch)
tree3909abba0a647adf00db9b2e3b951f126bda9750 /src/nvim/normal.c
parenta1596f0b0bb7e2a84e062a27fabe618d085a2947 (diff)
downloadrneovim-d2a38dab8085ddb973393ca7f077ff65d64f60ef.tar.gz
rneovim-d2a38dab8085ddb973393ca7f077ff65d64f60ef.tar.bz2
rneovim-d2a38dab8085ddb973393ca7f077ff65d64f60ef.zip
move.c: dont invalidate viewport when no scroll happened
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r--src/nvim/normal.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 2e49108028..f6add44f6a 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -4117,10 +4117,10 @@ void scroll_redraw(int up, long count)
int prev_topfill = curwin->w_topfill;
linenr_T prev_lnum = curwin->w_cursor.lnum;
- if (up)
- scrollup(count, true);
- else
+ bool moved = up ?
+ scrollup(count, true) :
scrolldown(count, true);
+
if (get_scrolloff_value()) {
// Adjust the cursor position for 'scrolloff'. Mark w_topline as
// valid, otherwise the screen jumps back at the end of the file.
@@ -4152,7 +4152,9 @@ void scroll_redraw(int up, long count)
}
if (curwin->w_cursor.lnum != prev_lnum)
coladvance(curwin->w_curswant);
- curwin->w_viewport_invalid = true;
+ // XXX: can `moved` be used to prevent other work here?
+ if (moved)
+ curwin->w_viewport_invalid = true;
redraw_later(VALID);
}