]> granicus.if.org Git - vim/commitdiff
patch 8.1.0497: :%diffput changes order of lines v8.1.0497
authorBram Moolenaar <Bram@vim.org>
Thu, 25 Oct 2018 15:52:23 +0000 (17:52 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 25 Oct 2018 15:52:23 +0000 (17:52 +0200)
Problem:    :%diffput changes order of lines. (Markus Braun)
Solution:   Do adjust marks when using internal diff.

src/diff.c
src/testdir/test_diffmode.vim
src/version.c

index 054924e67e8548053f4fa75d6eb562d3fae28cb7..23503d8266b917faa09c51f97da0bcc3c1636b1d 100644 (file)
@@ -298,9 +298,9 @@ diff_mark_adjust_tp(
        // Will update diffs before redrawing.  Set _invalid to update the
        // diffs themselves, set _update to also update folds properly just
        // before redrawing.
+       // Do update marks here, it is needed for :%diffput.
        tp->tp_diff_invalid = TRUE;
        tp->tp_diff_update = TRUE;
-       return;
     }
 
     if (line2 == MAXLNUM)
@@ -2850,7 +2850,7 @@ theend:
     if (diff_need_update)
        ex_diffupdate(NULL);
 
-    // Check that the cursor is on a valid character and update it's
+    // Check that the cursor is on a valid character and update its
     // position.  When there were filler lines the topline has become
     // invalid.
     check_cursor();
index e1da19fefe3a22fa7bc1274910ef05162b146c8c..6a8bea0ec52e6cefda1984afade19f7f1a7870f3 100644 (file)
@@ -221,6 +221,26 @@ func Test_diffget_diffput()
   %bwipe!
 endfunc
 
+" Test putting two changes from one buffer to another
+func Test_diffput_two()
+  new a
+  let win_a = win_getid()
+  call setline(1, range(1, 10))
+  diffthis
+  new b
+  let win_b = win_getid()
+  call setline(1, range(1, 10))
+  8del
+  5del
+  diffthis
+  call win_gotoid(win_a)
+  %diffput
+  call win_gotoid(win_b)
+  call assert_equal(map(range(1, 10), 'string(v:val)'), getline(1, '$'))
+  bwipe! a
+  bwipe! b
+endfunc
+
 func Test_dp_do_buffer()
   e! one
   let bn1=bufnr('%')
index 3d31fa756d6bbd89ab910e37d2b368941a0bae93..c3f2e23918308f9aeae4b2b9a4bf90bc11561fc2 100644 (file)
@@ -792,6 +792,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    497,
 /**/
     496,
 /**/