diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-02-19 15:26:18 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-02-19 15:26:18 +0100 |
commit | d56a79d3396cf70861b7f739a3c400db91ce7b70 (patch) | |
tree | 0762c78f9b377635cb493f8698210636616b01c1 /src | |
parent | 5acff71d3bd7796ee0a112ceb891af630b59304e (diff) |
patch 8.0.0341: undo does not work properly when using completionv8.0.0341
Problem: When using complete() and typing a character undo is saved after
the character was inserted. (Shougo)
Solution: Save for undo before inserting the character.
Diffstat (limited to 'src')
-rw-r--r-- | src/edit.c | 4 | ||||
-rw-r--r-- | src/testdir/test_popup.vim | 20 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 26 insertions, 0 deletions
diff --git a/src/edit.c b/src/edit.c index a37261ffab..d7f89bcbed 100644 --- a/src/edit.c +++ b/src/edit.c @@ -3583,7 +3583,11 @@ ins_compl_addleader(int c) { #ifdef FEAT_MBYTE int cc; +#endif + if (stop_arrow() == FAIL) + return; +#ifdef FEAT_MBYTE if (has_mbyte && (cc = (*mb_char2len)(c)) > 1) { char_u buf[MB_MAXBYTES + 1]; diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim index f4ce064d7b..2c6afa06c2 100644 --- a/src/testdir/test_popup.vim +++ b/src/testdir/test_popup.vim @@ -531,4 +531,24 @@ func Test_completion_respect_bs_option() bw! endfunc +func CompleteUndo() abort + call complete(1, g:months) + return '' +endfunc + +func Test_completion_can_undo() + inoremap <Right> <c-r>=CompleteUndo()<cr> + set completeopt+=noinsert,noselect + + new + call feedkeys("a\<Right>a\<Esc>", 'xt') + call assert_equal('a', getline(1)) + undo + call assert_equal('', getline(1)) + + bwipe! + set completeopt& + iunmap <Right> +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index ef71d0e391..f12c508d49 100644 --- 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 */ /**/ + 341, +/**/ 340, /**/ 339, |