vim-patch:9.1.1056: Vim doesn't highlight to be inserted text when completing (#32251)

Problem:  Vim doesn't highlight to be inserted text when completing
Solution: Add support for the "preinsert" 'completeopt' value
          (glepnir)

Support automatically inserting the currently selected candidate word
that does not belong to the latter part of the leader.

fixes: vim/vim#3433
closes: vim/vim#16403

edd4ac3e89

Co-authored-by: glepnir <glephunter@gmail.com>
This commit is contained in:
zeertzjq
2025-01-30 14:39:13 +08:00
committed by GitHub
parent 35c5e23107
commit efa664c7ed
10 changed files with 205 additions and 9 deletions

View File

@@ -609,7 +609,10 @@ static int insert_execute(VimState *state, int key)
&& (s->c == CAR || s->c == K_KENTER || s->c == NL)))
&& stop_arrow() == OK) {
ins_compl_delete(false);
ins_compl_insert(false);
ins_compl_insert(false, false);
} else if (ascii_iswhite_nl_or_nul(s->c) && ins_compl_preinsert_effect()) {
// Delete preinserted text when typing special chars
ins_compl_delete(false);
}
}
}