mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.0.0341 (#6151)
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.
d56a79d339
This commit is contained in:
parent
34e24cb2f7
commit
4e21311f9c
@ -3001,6 +3001,9 @@ static void ins_compl_addleader(int c)
|
||||
{
|
||||
int cc;
|
||||
|
||||
if (stop_arrow() == FAIL) {
|
||||
return;
|
||||
}
|
||||
if (has_mbyte && (cc = (*mb_char2len)(c)) > 1) {
|
||||
char_u buf[MB_MAXBYTES + 1];
|
||||
|
||||
|
@ -482,4 +482,24 @@ func Test_completion_ctrl_e_without_autowrap()
|
||||
q!
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user