# HG changeset patch # User Christian Brabandt # Date 1476730804 -7200 # Node ID d9bd03a0d70fccb322becc16b4d3f40a7cccbcab # Parent a15146e381505dfc3ff263593b94a6d52c7b98ba commit https://github.com/vim/vim/commit/cbd3bd6cbed5baf418b037b17ad46e339ff59174 Author: Bram Moolenaar Date: Mon Oct 17 20:47:02 2016 +0200 patch 8.0.0042 Problem: When using Insert mode completion with 'completeopt' containing "noinsert" change is not saved for undo. (Tommy Allen) Solution: Call stop_arrow() before inserting for pressing Enter. diff --git a/src/edit.c b/src/edit.c --- a/src/edit.c +++ b/src/edit.c @@ -857,8 +857,9 @@ edit( /* Pressing CTRL-Y selects the current match. When * compl_enter_selects is set the Enter key does the same. */ - if (c == Ctrl_Y || (compl_enter_selects - && (c == CAR || c == K_KENTER || c == NL))) + if ((c == Ctrl_Y || (compl_enter_selects + && (c == CAR || c == K_KENTER || c == NL))) + && stop_arrow() == OK) { ins_compl_delete(); ins_compl_insert(FALSE); diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim --- a/src/testdir/test_popup.vim +++ b/src/testdir/test_popup.vim @@ -420,6 +420,13 @@ func Test_complete_no_undo() call feedkeys("u", 'xt') call assert_equal('', getline(2)) + call feedkeys("ibbb\0", 'xt') + call assert_equal('bbb', getline(2)) + call feedkeys("A\\\\", 'xt') + call assert_equal('January', getline(2)) + call feedkeys("u", 'xt') + call assert_equal('bbb', getline(2)) + iunmap set completeopt& q! 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 */ /**/ + 42, +/**/ 41, /**/ 40,