patch 9.1.1750: completion: preinserted text highlighed using ComplMatchIns

Problem:  completion: preinserted text highlighed using ComplMatchIns
Solution: Use highlighting group PreInsert and update the documentation
          (Girish Palya).

When "preinsert" is included in 'completeopt', only the PreInsert
highlight group should be applied, whether autocompletion is active or not.
Previously, ComplMatchIns was used when autocompletion was not enabled.

Related to https://github.com/vim/vim/pull/18213.

closes: #18254

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-10 04:04:24 -04:00
committed by Christian Brabandt
parent f6659f6e61
commit 2525c56e42
5 changed files with 16 additions and 13 deletions

View File

@ -1067,10 +1067,13 @@ ins_compl_col_range_attr(linenr_T lnum, int col)
{
int start_col;
int attr;
int has_preinsert = ins_compl_has_preinsert();
if ((get_cot_flags() & COT_FUZZY)
|| (!compl_autocomplete
|| (!has_preinsert
&& (attr = syn_name2attr((char_u *)"ComplMatchIns")) == 0)
|| (!compl_autocomplete && has_preinsert
&& (attr = syn_name2attr((char_u *)"PreInsert")) == 0)
|| (compl_autocomplete
&& (!compl_autocomplete_preinsert
|| (attr = syn_name2attr((char_u *)"PreInsert")) == 0)))
@ -2531,9 +2534,7 @@ ins_compl_new_leader(void)
if (compl_started && compl_autocomplete
&& !ins_compl_preinsert_effect())
{
if (ins_compl_insert(TRUE, TRUE) != OK)
(void)ins_compl_insert(FALSE, FALSE);
else
if (ins_compl_insert(TRUE, TRUE) == OK)
compl_autocomplete_preinsert = TRUE;
}
else

View File

@ -1,7 +1,7 @@
|f+0&#ffffff0|o@1| @71
|f|o@1|b|a|r| @68
|f|o@1|b|a|r|b|a|z| @65
|f>o@1| @71
|f>o+0#00e0003&@1| +0#0000000&@71
|f+0#0000001#e0e0e08|o@1| @11| +0#4040ff13#ffffff0@59
|f+0#0000001#ffd7ff255|o@1|b|a|r| @8| +0#4040ff13#ffffff0@59
|f+0#0000001#ffd7ff255|o@1|b|a|r|b|a|z| @5| +0#4040ff13#ffffff0@59

View File

@ -724,6 +724,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1750,
/**/
1749,
/**/