0
0
mirror of https://github.com/vim/vim.git synced 2025-11-15 23:14:06 -05:00

patch 9.1.1742: complete: preinsert does not work well with preinsert

Problem:  complete: preinsert does not work well with preinsert
Solution: Make "preinsert" completeopt value work with autocompletion
          (Girish Palya)

This change extends Insert mode autocompletion so that 'preinsert' also
works when 'autocomplete' is enabled.

Try: `:set ac cot=preinsert`

See `:help 'cot'` for more details.

closes: #18213

Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Girish Palya
2025-09-08 15:23:29 -04:00
committed by Christian Brabandt
parent 4ed19fd336
commit fa6fd41a94
14 changed files with 364 additions and 50 deletions

View File

@@ -693,7 +693,11 @@ edit(
&& stop_arrow() == OK)
{
ins_compl_delete();
ins_compl_insert(FALSE);
if (ins_compl_has_preinsert()
&& ins_compl_has_autocomplete())
(void)ins_compl_insert(FALSE, TRUE);
else
(void)ins_compl_insert(FALSE, FALSE);
}
// Delete preinserted text when typing special chars
else if (IS_WHITE_NL_OR_NUL(c) && ins_compl_preinsert_effect())