aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/popupmenu.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/nvim/popupmenu.c b/src/nvim/popupmenu.c
index 2e533bea23..3860ba8f6a 100644
--- a/src/nvim/popupmenu.c
+++ b/src/nvim/popupmenu.c
@@ -430,12 +430,10 @@ static int *pum_compute_text_attrs(char *text, hlf_T hlf, int user_hlattr)
size_t leader_len = strlen(leader);
garray_T *ga = NULL;
- bool matched_start = false;
+ int matched_len = -1;
if (in_fuzzy) {
ga = fuzzy_match_str_with_pos(text, leader);
- } else {
- matched_start = mb_strnicmp(text, leader, leader_len) == 0;
}
const char *ptr = text;
@@ -456,10 +454,16 @@ static int *pum_compute_text_attrs(char *text, hlf_T hlf, int user_hlattr)
break;
}
}
- } else if (matched_start && ptr < text + leader_len) {
- new_attr = win_hl_attr(curwin, is_select ? HLF_PMSI : HLF_PMNI);
- new_attr = hl_combine_attr(win_hl_attr(curwin, HLF_PMNI), new_attr);
- new_attr = hl_combine_attr(win_hl_attr(curwin, (int)hlf), new_attr);
+ } else {
+ if (matched_len < 0 && mb_strnicmp(ptr, leader, leader_len) == 0) {
+ matched_len = (int)leader_len;
+ }
+ if (matched_len > 0) {
+ new_attr = win_hl_attr(curwin, is_select ? HLF_PMSI : HLF_PMNI);
+ new_attr = hl_combine_attr(win_hl_attr(curwin, HLF_PMNI), new_attr);
+ new_attr = hl_combine_attr(win_hl_attr(curwin, (int)hlf), new_attr);
+ matched_len--;
+ }
}
new_attr = hl_combine_attr(win_hl_attr(curwin, HLF_PNI), new_attr);