# HG changeset patch # User Christian Brabandt # Date 1484687704 -3600 # Node ID cbf17371627c868070e4fb0425f21d751a61bdde # Parent a7d9b73e8f3c53a00f2bf2291cad64721798e1d3 patch 8.0.0205: wrong behavior after :undojoin commit https://github.com/vim/vim/commit/5e4e1b12998b1ed99138cad1c5da4d430f798547 Author: Bram Moolenaar Date: Tue Jan 17 22:09:45 2017 +0100 patch 8.0.0205: wrong behavior after :undojoin Problem: After :undojoin some commands don't work properly, such as :redo. (Matthew Malcomson) Solution: Don't set curbuf->b_u_curhead. (closes #1390) diff --git a/src/testdir/test_undo.vim b/src/testdir/test_undo.vim --- a/src/testdir/test_undo.vim +++ b/src/testdir/test_undo.vim @@ -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\", 'xt') + call feedkeys(":undojoin | redo\", 'xt') + call assert_equal('xxfirst line', getline(1)) + call assert_equal('second line', getline(2)) + bwipe! endfunc func Test_undo_write() diff --git a/src/undo.c b/src/undo.c --- a/src/undo.c +++ b/src/undo.c @@ -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; } /* diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -765,6 +765,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 205, +/**/ 204, /**/ 203,