]> granicus.if.org Git - vim/commitdiff
patch 8.0.0205: wrong behavior after :undojoin v8.0.0205
authorBram Moolenaar <Bram@vim.org>
Tue, 17 Jan 2017 21:09:45 +0000 (22:09 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 17 Jan 2017 21:09:45 +0000 (22:09 +0100)
Problem:    After :undojoin some commands don't work properly, such as :redo.
            (Matthew Malcomson)
Solution:   Don't set curbuf->b_u_curhead. (closes #1390)

src/testdir/test_undo.vim
src/undo.c
src/version.c

index f2ac6a8eabeef4f39c0be2044dd9db7a51bb4b88..06732af71568dc72f34bcab8d8a8016ac577b9ab 100644 (file)
@@ -176,7 +176,17 @@ func Test_undojoin()
   call assert_equal(['aaaa', 'bbbb', 'cccc'], getline(2, '$'))
   call feedkeys("u", 'xt')
   call assert_equal(['aaaa'], getline(2, '$'))
-  close!
+  bwipe!
+endfunc
+
+func Test_undojoin_redo()
+  new
+  call setline(1, ['first line', 'second line'])
+  call feedkeys("ixx\<Esc>", 'xt')
+  call feedkeys(":undojoin | redo\<CR>", 'xt')
+  call assert_equal('xxfirst line', getline(1))
+  call assert_equal('second line', getline(2))
+  bwipe!
 endfunc
 
 func Test_undo_write()
index 607f35fdd861e71c222d5aca0c8f0aa0263b54a3..b69f3187235c466c85ff1515c51786f220af0735 100644 (file)
@@ -3136,11 +3136,8 @@ ex_undojoin(exarg_T *eap UNUSED)
     if (get_undolevel() < 0)
        return;             /* no entries, nothing to do */
     else
-    {
-       /* Go back to the last entry */
-       curbuf->b_u_curhead = curbuf->b_u_newhead;
-       curbuf->b_u_synced = FALSE;  /* no entries, nothing to do */
-    }
+       /* Append next change to the last entry */
+       curbuf->b_u_synced = FALSE;
 }
 
 /*
index a99c17e7bd3d6cc8d4c6b2ad5cefa64139e24135..766f9890c88e8e32305b6773587e6c03d92cdfd6 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    205,
 /**/
     204,
 /**/