summaryrefslogtreecommitdiff
path: root/src/move.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-07-10 15:07:15 +0200
committerBram Moolenaar <Bram@vim.org>2018-07-10 15:07:15 +0200
commit907dad72ef9d29422352fb74ba156e7085a3fc71 (patch)
tree87f564906e64ad84b4c09a941f3fd873784570a9 /src/move.c
parent6259e5769dd50d8a3b5b99f553bab34ff5c8a6ce (diff)
downloadvim-git-907dad72ef9d29422352fb74ba156e7085a3fc71.tar.gz
patch 8.1.0174: after paging up and down fold line is wrongv8.1.0174
Problem: After paging up and down fold line is wrong. Solution: Correct the computation of w_topline and w_botline. (Hirohito Higashi)
Diffstat (limited to 'src/move.c')
-rw-r--r--src/move.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/move.c b/src/move.c
index a56003013..b2b84868a 100644
--- a/src/move.c
+++ b/src/move.c
@@ -2457,22 +2457,27 @@ onepage(int dir, long count)
beginline(BL_SOL | BL_FIX);
curwin->w_valid &= ~(VALID_WCOL|VALID_WROW|VALID_VIRTCOL);
- /*
- * Avoid the screen jumping up and down when 'scrolloff' is non-zero.
- * But make sure we scroll at least one line (happens with mix of long
- * wrapping lines and non-wrapping line).
- */
- if (retval == OK && dir == FORWARD && check_top_offset())
+ if (retval == OK && dir == FORWARD)
{
- scroll_cursor_top(1, FALSE);
- if (curwin->w_topline <= old_topline
- && old_topline < curbuf->b_ml.ml_line_count)
+ // Avoid the screen jumping up and down when 'scrolloff' is non-zero.
+ // But make sure we scroll at least one line (happens with mix of long
+ // wrapping lines and non-wrapping line).
+ if (check_top_offset())
{
- curwin->w_topline = old_topline + 1;
+ scroll_cursor_top(1, FALSE);
+ if (curwin->w_topline <= old_topline
+ && old_topline < curbuf->b_ml.ml_line_count)
+ {
+ curwin->w_topline = old_topline + 1;
#ifdef FEAT_FOLDING
- (void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL);
+ (void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL);
#endif
+ }
}
+#ifdef FEAT_FOLDING
+ else if (curwin->w_botline > curbuf->b_ml.ml_line_count)
+ (void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL);
+#endif
}
redraw_later(VALID);