]> granicus.if.org Git - vim/commitdiff
patch 8.2.3556: filler lines are incorrect for other window in diff mode v8.2.3556
authorBram Moolenaar <Bram@vim.org>
Fri, 22 Oct 2021 19:56:55 +0000 (20:56 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 22 Oct 2021 19:56:55 +0000 (20:56 +0100)
Problem:    Filler lines are incorrect for other window in diff mode after
            making a change.
Solution:   Copy filler lines from the current window. (closes #8809)

src/diff.c
src/testdir/dumps/Test_diff_scroll_change_03.dump [new file with mode: 0644]
src/testdir/test_diffmode.vim
src/version.c

index b59a1251066b2c8476a3dbaed8c97ab3910e0fe8..92a4d9f44e9d9d9ba3c03d00e99296373cf42f07 100644 (file)
@@ -656,7 +656,8 @@ diff_redraw(
 {
     win_T      *wp;
     win_T      *wp_other = NULL;
-    int                used_max_fill = FALSE;
+    int                used_max_fill_other = FALSE;
+    int                used_max_fill_curwin = FALSE;
     int                n;
 
     need_diff_redraw = FALSE;
@@ -681,16 +682,25 @@ diff_redraw(
                {
                    wp->w_topfill = n;
                    if (wp == curwin)
-                       used_max_fill = TRUE;
+                       used_max_fill_curwin = TRUE;
+                   else if (wp_other != NULL)
+                       used_max_fill_other = TRUE;
                }
                check_topfill(wp, FALSE);
            }
        }
 
-    if (wp_other != NULL && used_max_fill && curwin->w_p_scb)
-       // The current window was set to used the maximum number of filler
-       // lines, may need to reduce them.
-       diff_set_topline(wp_other, curwin);
+    if (wp_other != NULL && curwin->w_p_scb)
+    {
+       if (used_max_fill_curwin)
+           // The current window was set to used the maximum number of filler
+           // lines, may need to reduce them.
+           diff_set_topline(wp_other, curwin);
+       else if (used_max_fill_other)
+           // The other window was set to used the maximum number of filler
+           // lines, may need to reduce them.
+           diff_set_topline(curwin, wp_other);
+    }
 }
 
     static void
diff --git a/src/testdir/dumps/Test_diff_scroll_change_03.dump b/src/testdir/dumps/Test_diff_scroll_change_03.dump
new file mode 100644 (file)
index 0000000..6d0c860
--- /dev/null
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|6+0#0000000#5fd7ff255| @33
+| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|7+0#0000000#5fd7ff255| @33
+| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|8+0#0000000#5fd7ff255| @33
+| +0#0000e05#a8a8a8255@1|9+0#0000000#ffffff0| @33||+1&&| +0#0000e05#a8a8a8255@1|9+0#0000000#ffffff0| @33
+| +0#0000e05#a8a8a8255@1|1+0#0000000#ffffff0|0| @32||+1&&| +0#0000e05#a8a8a8255@1|1+0#0000000#ffffff0|0| @32
+| +0#0000e05#a8a8a8255@1|1+0#0000000#ffffff0@1| @32||+1&&| +0#0000e05#a8a8a8255@1|1+0#0000000#ffffff0@1| @32
+| +0#0000e05#a8a8a8255@1|1+0#0000000#ffffff0|2| @32||+1&&| +0#0000e05#a8a8a8255@1|1+0#0000000#ffffff0|2| @32
+| +0#0000e05#a8a8a8255@1|1+0#0000000#ffffff0|3| @32||+1&&| +0#0000e05#a8a8a8255@1|1+0#0000000#ffffff0|3| @32
+| +0#0000e05#a8a8a8255@1|1+0#0000000#ffffff0|4| @32||+1&&| +0#0000e05#a8a8a8255@1|1+0#0000000#ffffff0|4| @32
+| +0#0000e05#a8a8a8255@1|1+0#0000000#ffd7ff255|5|x+2&#ff404010| +0&#ffd7ff255@31||+1&#ffffff0| +0#0000e05#a8a8a8255@1|1+0#0000000#ffd7ff255|5>y+2&#ff404010| +0&#ffd7ff255@31
+|~+0#4040ff13#ffffff0| @35||+1#0000000&|~+0#4040ff13&| @35
+|~| @35||+1#0000000&|~+0#4040ff13&| @35
+|~| @35||+1#0000000&|~+0#4040ff13&| @35
+|~| @35||+1#0000000&|~+0#4040ff13&| @35
+|~| @35||+1#0000000&|~+0#4040ff13&| @35
+|~| @35||+1#0000000&|~+0#4040ff13&| @35
+|~| @35||+1#0000000&|~+0#4040ff13&| @35
+|~| @35||+1#0000000&|~+0#4040ff13&| @35
+|[+1#0000000&|N|o| |N|a|m|e|]| |[|+|]| @5|7|,|3| @11|A|l@1| |[+3&&|N|o| |N|a|m|e|]| |[|+|]| @5|1|5|,|3| @10|B|o|t
+| +0&&@74
index 08ec71b9187286ca3ad3ffb691c81fbd1c1b223c..e8bd0871b1f38a69484276fab4b1fe61d10159ce 100644 (file)
@@ -1013,6 +1013,9 @@ func Test_diff_with_scroll_and_change()
   call term_sendkeys(buf, "ax\<Esc>")
   call VerifyScreenDump(buf, 'Test_diff_scroll_change_02', {})
 
+  call term_sendkeys(buf, "\<C-W>lay\<Esc>")
+  call VerifyScreenDump(buf, 'Test_diff_scroll_change_03', {})
+
   " clean up
   call StopVimInTerminal(buf)
   call delete('Xtest_scroll_change')
index 1c2231f145b611bd1b58ddf4eecfbf3d4c10a10b..362129eb26cd8274d3a7ab774b199d699682c857 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3556,
 /**/
     3555,
 /**/