diff src/move.c @ 7082:ad4c039349f6 v7.4.853

commit https://github.com/vim/vim/commit/cf619daa8e0ef9a335f27f65eb74e422a17d4f92 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Sep 1 20:53:24 2015 +0200 patch 7.4.853 Problem: "zt" in diff mode does not always work properly. (Gary Johnson) Solution: Don't count filler lines twice. (Christian Brabandt)
author Christian Brabandt <cb@256bit.org>
date Tue, 01 Sep 2015 21:00:05 +0200
parents 286fd54c7ae3
children 8a58dde655a8
line wrap: on
line diff
--- a/src/move.c
+++ b/src/move.c
@@ -1732,7 +1732,7 @@ scroll_cursor_top(min_scroll, always)
      * - at least 'scrolloff' lines above and below the cursor
      */
     validate_cheight();
-    used = curwin->w_cline_height;
+    used = curwin->w_cline_height; /* includes filler lines above */
     if (curwin->w_cursor.lnum < curwin->w_topline)
 	scrolled = used;
 
@@ -1751,10 +1751,12 @@ scroll_cursor_top(min_scroll, always)
     new_topline = top + 1;
 
 #ifdef FEAT_DIFF
-    /* count filler lines of the cursor window as context */
-    i = diff_check_fill(curwin, curwin->w_cursor.lnum);
-    used += i;
-    extra += i;
+    /* used already contains the number of filler lines above, don't add it
+     * again.
+     * TODO: if filler lines above new top are to be considered as context for
+     * the current window, leave next statement commented, else hide filler
+     * lines above cursor line, by adding them to extra */
+    /* extra += diff_check_fill(curwin, curwin->w_cursor.lnum); */
 #endif
 
     /*