patch 9.1.1059: completion: input text deleted with preinsert when adding leader
Problem: completion: input text deleted with preinsert when adding leader
Solution: remove compl_length and check the ptr for being equal
to pattern when preinsert is active (glepnir)
closes: #16545
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/insexpand.c b/src/insexpand.c
index 63b779d..df757ce 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -4094,7 +4094,7 @@
if (!in_fuzzy)
ptr = ins_compl_get_next_word_or_line(st->ins_buf, st->cur_match_pos,
&len, &cont_s_ipos);
- if (ptr == NULL)
+ if (ptr == NULL || (ins_compl_has_preinsert() && STRCMP(ptr, compl_pattern.string) == 0))
continue;
if (ins_compl_add_infercase(ptr, len, p_ic,
@@ -4342,7 +4342,7 @@
int has_preinsert = ins_compl_preinsert_effect();
if (has_preinsert)
{
- col = compl_col + ins_compl_leader_len() - compl_length;
+ col += ins_compl_leader_len();
curwin->w_cursor.col = compl_ins_end_col;
}