summaryrefslogtreecommitdiffstats
path: root/src/edit.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-04-17 22:14:32 +0200
committerBram Moolenaar <Bram@vim.org>2018-04-17 22:14:32 +0200
commite87edf3b85f607632e5431640071fdbc36b685b2 (patch)
treec8c38e712166b58229440e243acad08730b08113 /src/edit.c
parent561f8a5a4612751c2a4ebd6bf918cbc3be867350 (diff)
patch 8.0.1731: characters deleted on completionv8.0.1731
Problem: Characters deleted on completion. (Adrià Farrés) Solution: Also check the last item for the ORIGINAL_TEXT flag. (Christian Brabandt, closes #1645)
Diffstat (limited to 'src/edit.c')
-rw-r--r--src/edit.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/edit.c b/src/edit.c
index 21941cb3d0..8746436fba 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -3656,7 +3656,9 @@ ins_compl_set_original_text(char_u *str)
{
char_u *p;
- /* Replace the original text entry. */
+ /* 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 */
{
p = vim_strsave(str);
@@ -3666,6 +3668,16 @@ ins_compl_set_original_text(char_u *str)
compl_first_match->cp_str = p;
}
}
+ else if (compl_first_match->cp_prev != NULL
+ && (compl_first_match->cp_prev->cp_flags & ORIGINAL_TEXT))
+ {
+ p = vim_strsave(str);
+ if (p != NULL)
+ {
+ vim_free(compl_first_match->cp_prev->cp_str);
+ compl_first_match->cp_prev->cp_str = p;
+ }
+ }
}
/*