]> granicus.if.org Git - vim/commitdiff
patch 8.2.5155: in diff mode windows may get out of sync v8.2.5155
authorBram Moolenaar <Bram@vim.org>
Fri, 24 Jun 2022 11:38:57 +0000 (12:38 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 24 Jun 2022 11:38:57 +0000 (12:38 +0100)
Problem:    In diff mode windows may get out of sync. (Gary Johnson)
Solution:   Avoid that the other window scrolls for 'cursorbind'.

src/move.c
src/testdir/dumps/Test_diff_scroll_1.dump [new file with mode: 0644]
src/testdir/dumps/Test_diff_scroll_2.dump [new file with mode: 0644]
src/testdir/test_diffmode.vim
src/version.c

index c2e271203b705c1277f19fd941fcc2620d7110c5..b061a753cd9acd8e3bebec43fe442ea9a5e6bfee 100644 (file)
@@ -2952,7 +2952,12 @@ do_check_cursorbind(void)
            restart_edit_save = restart_edit;
            restart_edit = TRUE;
            check_cursor();
-           validate_cursor();
+
+           // Avoid a scroll here for the cursor position, 'scrollbind' is
+           // more important.
+           if (!curwin->w_p_scb)
+               validate_cursor();
+
            restart_edit = restart_edit_save;
            // Correct cursor for multi-byte character.
            if (has_mbyte)
diff --git a/src/testdir/dumps/Test_diff_scroll_1.dump b/src/testdir/dumps/Test_diff_scroll_1.dump
new file mode 100644 (file)
index 0000000..ee53c35
--- /dev/null
@@ -0,0 +1,12 @@
+| +0#0000e05#a8a8a8255@1|l+0#0000000#ffffff0|i|n|e| |1| @28||+1&&| +0#0000e05#a8a8a8255@1|l+0#0000000#ffffff0|i|n|e| |1| @28
+| +0#0000e05#a8a8a8255@1|l+0#0000000#ffffff0|i|n|e| |2| @28||+1&&| +0#0000e05#a8a8a8255@1|l+0#0000000#ffffff0|i|n|e| |2| @28
+| +0#0000e05#a8a8a8255@1|l+0#0000000#ffffff0|i|n|e| |3| @28||+1&&| +0#0000e05#a8a8a8255@1|l+0#0000000#ffffff0|i|n|e| |3| @28
+| +0#0000e05#a8a8a8255@1|l+0#0000000#ffffff0|i|n|e| |4| @28||+1&&| +0#0000e05#a8a8a8255@1|l+0#0000000#ffffff0|i|n|e| |4| @28
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@34||+1&&| +0#0000e05#a8a8a8255@1> +0#0000000#ffffff0@34
+| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|L+0#0000000#5fd7ff255|o|r|e|m| @29
+| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|i+0#0000000#5fd7ff255|p|s|u|m| @29
+| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|d+0#0000000#5fd7ff255|o|l|o|r| @29
+| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|s+0#0000000#5fd7ff255|i|t| @31
+| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|a+0#0000000#5fd7ff255|m|e|t|,| @29
+|X+1&#ffffff0|l|e|f|t| @13|5|,|0|-|1| @9|T|o|p| |X+3&&|r|i|g|h|t| @12|5|,|0|-|1| @9|T|o|p
+|"+0&&|X|r|i|g|h|t|"| |3@1|L|,| |2|6|3|B| @56
diff --git a/src/testdir/dumps/Test_diff_scroll_2.dump b/src/testdir/dumps/Test_diff_scroll_2.dump
new file mode 100644 (file)
index 0000000..4cac386
--- /dev/null
@@ -0,0 +1,12 @@
+| +0#0000e05#a8a8a8255@1|l+0#0000000#ffffff0|i|n|e| |1| @28||+1&&| +0#0000e05#a8a8a8255@1|l+0#0000000#ffffff0|i|n|e| |1| @28
+| +0#0000e05#a8a8a8255@1|l+0#0000000#ffffff0|i|n|e| |2| @28||+1&&| +0#0000e05#a8a8a8255@1|l+0#0000000#ffffff0|i|n|e| |2| @28
+| +0#0000e05#a8a8a8255@1|l+0#0000000#ffffff0|i|n|e| |3| @28||+1&&| +0#0000e05#a8a8a8255@1|l+0#0000000#ffffff0|i|n|e| |3| @28
+| +0#0000e05#a8a8a8255@1|l+0#0000000#ffffff0|i|n|e| |4| @28||+1&&| +0#0000e05#a8a8a8255@1|l+0#0000000#ffffff0|i|n|e| |4| @28
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@34||+1&&| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@34
+| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1>L+0#0000000#5fd7ff255|o|r|e|m| @29
+| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|i+0#0000000#5fd7ff255|p|s|u|m| @29
+| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|d+0#0000000#5fd7ff255|o|l|o|r| @29
+| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|s+0#0000000#5fd7ff255|i|t| @31
+| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|a+0#0000000#5fd7ff255|m|e|t|,| @29
+|X+1&#ffffff0|l|e|f|t| @13|6|,|1| @11|T|o|p| |X+3&&|r|i|g|h|t| @12|6|,|1| @11|T|o|p
+|"+0&&|X|r|i|g|h|t|"| |3@1|L|,| |2|6|3|B| @56
index a632b19bceef32da1ce8493be7be79b41397bd9f..03c6c798e05e79cdc09e419f44479187c0b07b01 100644 (file)
@@ -1535,4 +1535,73 @@ func Test_diff_foldinvert()
   set scrollbind&
 endfunc
 
+" This was scrolling for 'cursorbind' but 'scrollbind' is more important
+func Test_diff_scroll()
+  CheckScreendump
+
+  let left =<< trim END
+      line 1
+      line 2
+      line 3
+      line 4
+
+      // Common block
+      // one
+      // containing
+      // four lines
+
+      // Common block
+      // two
+      // containing
+      // four lines
+  END
+  call writefile(left, 'Xleft')
+  let right =<< trim END
+      line 1
+      line 2
+      line 3
+      line 4
+
+      Lorem
+      ipsum
+      dolor
+      sit
+      amet,
+      consectetur
+      adipiscing
+      elit.
+      Etiam
+      luctus
+      lectus
+      sodales,
+      dictum
+
+      // Common block
+      // one
+      // containing
+      // four lines
+
+      Vestibulum
+      tincidunt
+      aliquet
+      nulla.
+
+      // Common block
+      // two
+      // containing
+      // four lines
+  END
+  call writefile(right, 'Xright')
+  let buf = RunVimInTerminal('-d Xleft Xright', {'rows': 12})
+  call term_sendkeys(buf, "\<C-W>\<C-W>jjjj")
+  call VerifyScreenDump(buf, 'Test_diff_scroll_1', {})
+  call term_sendkeys(buf, "j")
+  call VerifyScreenDump(buf, 'Test_diff_scroll_2', {})
+
+  call StopVimInTerminal(buf)
+  call delete('Xleft')
+  call delete('Xright')
+endfunc
+
+
 " vim: shiftwidth=2 sts=2 expandtab
index a915c5c2f0c20af5a43ce0e9dbf270531a0b3c13..4f9d8913a98fe3a950d19b8434ac199de63f0619 100644 (file)
@@ -735,6 +735,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    5155,
 /**/
     5154,
 /**/