diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/nvim/move.c | 12 | ||||
| -rw-r--r-- | src/nvim/version.c | 4 | 
2 files changed, 9 insertions, 7 deletions
diff --git a/src/nvim/move.c b/src/nvim/move.c index eb55397511..ba79c0411a 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -1288,9 +1288,10 @@ void scroll_cursor_top(int min_scroll, int always)     * - at least 'scrolloff' lines above and below the cursor     */    validate_cheight(); -  int used = curwin->w_cline_height; -  if (curwin->w_cursor.lnum < curwin->w_topline) +  int used = curwin->w_cline_height;  // includes filler lines above +  if (curwin->w_cursor.lnum < curwin->w_topline) {      scrolled = used; +  }    if (hasFolding(curwin->w_cursor.lnum, &top, &bot)) {      --top; @@ -1301,9 +1302,10 @@ void scroll_cursor_top(int min_scroll, int always)    }    new_topline = top + 1; -  /* count filler lines of the cursor window as context */ +  // "used" already contains the number of filler lines above, don't add it +  // again. +  // Hide filler lines above cursor line by adding them to "extra".    int extra = diff_check_fill(curwin, curwin->w_cursor.lnum); -  used += extra;    /*     * Check if the lines from "top" to "bot" fit in the window.  If they do, @@ -1312,7 +1314,7 @@ void scroll_cursor_top(int min_scroll, int always)    while (top > 0) {      int i = hasFolding(top, &top, NULL)              ? 1  // count one logical line for a sequence of folded lines -            : plines(top); +            : plines_nofill(top);      used += i;      if (extra + i <= off && bot < curbuf->b_ml.ml_line_count) {        if (hasFolding(bot, NULL, &bot)) diff --git a/src/nvim/version.c b/src/nvim/version.c index 2d241204a6..ff00aaefba 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -432,10 +432,10 @@ static int included_patches[] = {    // 859,    858,    // 857, -  // 856, +  856,    // 855 NA    // 854 NA -  // 853, +  853,    // 852 NA    // 851 NA    // 850 NA  | 
