diff src/move.c @ 25717:d3f992bc6ef8 v8.2.3394

patch 8.2.3394: filler lines are wrong when changing text in diff mode Commit: https://github.com/vim/vim/commit/04626c243c47af91c2580eaf23e12286180e0e81 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Sep 1 16:02:07 2021 +0200 patch 8.2.3394: filler lines are wrong when changing text in diff mode Problem: Filler lines are wrong when changing text in diff mode. Solution: Don't change the filler lines on every change. Check scrollbinding when updating the filler lines. (closes #8809)
author Bram Moolenaar <Bram@vim.org>
date Wed, 01 Sep 2021 16:15:04 +0200
parents e8e2c4d33b9b
children 336e2d9924e6
line wrap: on
line diff
--- a/src/move.c
+++ b/src/move.c
@@ -535,6 +535,10 @@ changed_window_setting_win(win_T *wp)
     void
 set_topline(win_T *wp, linenr_T lnum)
 {
+#ifdef FEAT_DIFF
+    linenr_T prev_topline = wp->w_topline;
+#endif
+
 #ifdef FEAT_FOLDING
     // go to first of folded lines
     (void)hasFoldingWin(wp, lnum, &lnum, NULL, TRUE, NULL);
@@ -546,7 +550,9 @@ set_topline(win_T *wp, linenr_T lnum)
     wp->w_topline = lnum;
     wp->w_topline_was_set = TRUE;
 #ifdef FEAT_DIFF
-    wp->w_topfill = 0;
+    if (lnum != prev_topline)
+	// Keep the filler lines when the topline didn't change.
+	wp->w_topfill = 0;
 #endif
     wp->w_valid &= ~(VALID_WROW|VALID_CROW|VALID_BOTLINE|VALID_TOPLINE);
     // Don't set VALID_TOPLINE here, 'scrolloff' needs to be checked.