Skip to content

Commit cbd3bd6

Browse files
committed
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.
1 parent 869e352 commit cbd3bd6

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/edit.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -857,8 +857,9 @@ edit(
857857

858858
/* Pressing CTRL-Y selects the current match. When
859859
* compl_enter_selects is set the Enter key does the same. */
860-
if (c == Ctrl_Y || (compl_enter_selects
861-
&& (c == CAR || c == K_KENTER || c == NL)))
860+
if ((c == Ctrl_Y || (compl_enter_selects
861+
&& (c == CAR || c == K_KENTER || c == NL)))
862+
&& stop_arrow() == OK)
862863
{
863864
ins_compl_delete();
864865
ins_compl_insert(FALSE);

src/testdir/test_popup.vim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,13 @@ func Test_complete_no_undo()
420420
call feedkeys("u", 'xt')
421421
call assert_equal('', getline(2))
422422

423+
call feedkeys("ibbb\<Esc>0", 'xt')
424+
call assert_equal('bbb', getline(2))
425+
call feedkeys("A\<Right>\<Down>\<CR>\<Esc>", 'xt')
426+
call assert_equal('January', getline(2))
427+
call feedkeys("u", 'xt')
428+
call assert_equal('bbb', getline(2))
429+
423430
iunmap <Right>
424431
set completeopt&
425432
q!

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
42,
767769
/**/
768770
41,
769771
/**/

0 commit comments

Comments
 (0)