aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/move.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/move.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/move.c')
-rw-r--r--src/nvim/move.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/nvim/move.c b/src/nvim/move.c
index e2a304efa5..8084461d3a 100644
--- a/src/nvim/move.c
+++ b/src/nvim/move.c
@@ -1020,7 +1020,7 @@ void textpos2screenpos(win_T *wp, pos_T *pos, int *rowp, int *scolp,
/*
* Scroll the current window down by "line_count" logical lines. "CTRL-Y"
*/
-void
+bool
scrolldown (
long line_count,
int byfold /* true: count a closed fold as one line */
@@ -1095,17 +1095,21 @@ scrolldown (
foldAdjustCursor();
coladvance(curwin->w_curswant);
}
+ return moved;
}
/*
* Scroll the current window up by "line_count" logical lines. "CTRL-E"
*/
-void
+bool
scrollup (
long line_count,
int byfold /* true: count a closed fold as one line */
)
{
+ linenr_T topline = curwin->w_topline;
+ linenr_T botline = curwin->w_botline;
+
if ((byfold && hasAnyFolding(curwin))
|| curwin->w_p_diff) {
// count each sequence of folded lines as one logical line
@@ -1148,6 +1152,12 @@ scrollup (
~(VALID_WROW|VALID_WCOL|VALID_CHEIGHT|VALID_CROW|VALID_VIRTCOL);
coladvance(curwin->w_curswant);
}
+
+ bool moved =
+ topline != curwin->w_topline ||
+ botline != curwin->w_botline;
+
+ return moved;
}
/*