0
0
mirror of https://github.com/vim/vim.git synced 2025-11-10 10:47:23 -05:00

patch 9.1.0495: Matched text isn't highlighted in cmdline pum

Problem:  Matched text isn't highlighted in cmdline pum.
Solution: Use cmdline completion pattern in cmdline mode.
          (zeertzjq)

closes: #15029

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2024-06-17 18:25:32 +02:00
committed by Christian Brabandt
parent 84ac2126f4
commit d8c9340fc6
12 changed files with 132 additions and 5 deletions

View File

@@ -428,28 +428,35 @@ pum_under_menu(int row, int col, int only_redrawing)
pum_compute_text_attrs(char_u *text, hlf_T hlf)
{
int i;
int leader_len;
size_t leader_len;
int char_cells;
int new_attr;
char_u *ptr = text;
int cell_idx = 0;
garray_T *ga = NULL;
int *attrs = NULL;
char_u *leader = ins_compl_leader();
int in_fuzzy = (get_cot_flags() & COT_FUZZY) != 0;
char_u *leader = NULL;
int in_fuzzy;
int matched_start = FALSE;
int_u char_pos = 0;
if (leader == NULL || *leader == NUL || (hlf != HLF_PSI && hlf != HLF_PNI)
if ((hlf != HLF_PSI && hlf != HLF_PNI)
|| (highlight_attr[HLF_PMSI] == highlight_attr[HLF_PSI]
&& highlight_attr[HLF_PMNI] == highlight_attr[HLF_PNI]))
return NULL;
leader = State == MODE_CMDLINE ? cmdline_compl_pattern()
: ins_compl_leader();
if (leader == NULL || *leader == NUL)
return NULL;
attrs = ALLOC_MULT(int, vim_strsize(text));
if (attrs == NULL)
return NULL;
leader_len = (int)STRLEN(leader);
in_fuzzy = State == MODE_CMDLINE ? cmdline_compl_is_fuzzy()
: (get_cot_flags() & COT_FUZZY) != 0;
leader_len = STRLEN(leader);
if (in_fuzzy)
ga = fuzzy_match_str_with_pos(text, leader);