From c2491fbab43fc506f7f902c72206d890e01688a5 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 18 Jun 2024 06:02:01 +0800 Subject: vim-patch:9.1.0496: matched text is highlighted case-sensitively Problem: matched text is highlighted case-sensitively Solution: use MB_STRNICMP, update highlighting when the base changes (glepnir) fixes: vim/vim#15021 closes: vim/vim#15023 https://github.com/vim/vim/commit/f189138b39a11ed5cf3adea6610469b478841aba Co-authored-by: glepnir --- src/nvim/insexpand.c | 2 +- src/nvim/popupmenu.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/nvim') diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c index 0a25b72451..ded5c6e3c3 100644 --- a/src/nvim/insexpand.c +++ b/src/nvim/insexpand.c @@ -1397,7 +1397,7 @@ bool compl_match_curr_select(int selected) /// Get current completion leader char *ins_compl_leader(void) { - return compl_leader; + return compl_leader != NULL ? compl_leader : compl_orig_text; } /// Add any identifiers that match the given pattern "pat" in the list of diff --git a/src/nvim/popupmenu.c b/src/nvim/popupmenu.c index 2d3c128de1..8608a2c866 100644 --- a/src/nvim/popupmenu.c +++ b/src/nvim/popupmenu.c @@ -448,7 +448,8 @@ static int *pum_compute_text_attrs(char *text, hlf_T hlf) return NULL; } - char *leader = State == MODE_CMDLINE ? cmdline_compl_pattern() : ins_compl_leader(); + char *leader = State == MODE_CMDLINE ? cmdline_compl_pattern() + : ins_compl_leader(); if (leader == NULL || *leader == NUL) { return NULL; } @@ -464,7 +465,7 @@ static int *pum_compute_text_attrs(char *text, hlf_T hlf) if (in_fuzzy) { ga = fuzzy_match_str_with_pos(text, leader); } else { - matched_start = strncmp(text, leader, leader_len) == 0; + matched_start = mb_strnicmp(text, leader, leader_len) == 0; } const char *ptr = text; -- cgit