diff options
author | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-11-20 20:15:30 -0500 |
---|---|---|
committer | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-11-20 21:14:50 -0500 |
commit | bebd1f9f7629c6150e7eadcf0d33e9c90c81add2 (patch) | |
tree | 3dba358941c46daa6be531488053f3a9e4dc4f51 /src/nvim/edit.c | |
parent | 85761dd4269bff17e7607020bbb5ed9994afca61 (diff) | |
download | rneovim-bebd1f9f7629c6150e7eadcf0d33e9c90c81add2.tar.gz rneovim-bebd1f9f7629c6150e7eadcf0d33e9c90c81add2.tar.bz2 rneovim-bebd1f9f7629c6150e7eadcf0d33e9c90c81add2.zip |
vim-patch:8.0.1731: characters deleted on completion
Problem: Characters deleted on completion. (Adrià Farrés)
Solution: Also check the last item for the ORIGINAL_TEXT flag. (Christian
Brabandt, closes vim/vim#1645)
https://github.com/vim/vim/commit/e87edf3b85f607632e5431640071fdbc36b685b2
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r-- | src/nvim/edit.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index d20660bfb9..451d19b8e3 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -3127,10 +3127,16 @@ static void ins_compl_restart(void) */ static void ins_compl_set_original_text(char_u *str) { - /* Replace the original text entry. */ - if (compl_first_match->cp_flags & ORIGINAL_TEXT) { /* safety check */ + // Replace the original text entry. + // The ORIGINAL_TEXT flag is either at the first item or might possibly be + // at the last item for backward completion + if (compl_first_match->cp_flags & ORIGINAL_TEXT) { // safety check xfree(compl_first_match->cp_str); compl_first_match->cp_str = vim_strsave(str); + } else if (compl_first_match->cp_prev != NULL + && (compl_first_match->cp_prev->cp_flags & ORIGINAL_TEXT)) { + xfree(compl_first_match->cp_prev->cp_str); + compl_first_match->cp_prev->cp_str = vim_strsave(str); } } |