mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:9.1.0480: fuzzy string matching executed when not needed
Problem: fuzzy string matching executed when not needed
Solution: when no leader is available, can skip fuzzy logic, so return
early (glepnir)
closes: vim/vim#14986
1c29602662
Co-authored-by: glepnir <glephunter@gmail.com>
This commit is contained in:
parent
e2ef533025
commit
53b2817fd3
@ -442,23 +442,24 @@ static void pum_puts_with_attr(int col, char *text, int attr)
|
|||||||
{
|
{
|
||||||
char *leader = ins_compl_leader();
|
char *leader = ins_compl_leader();
|
||||||
|
|
||||||
if ((win_hl_attr(curwin, HLF_PMSI) == win_hl_attr(curwin, HLF_PSI)
|
if (leader == NULL || *leader == NUL
|
||||||
&& win_hl_attr(curwin, HLF_PMNI) == win_hl_attr(curwin, HLF_PNI))) {
|
|| (win_hl_attr(curwin, HLF_PMSI) == win_hl_attr(curwin, HLF_PSI)
|
||||||
|
&& win_hl_attr(curwin, HLF_PMNI) == win_hl_attr(curwin, HLF_PNI))) {
|
||||||
grid_line_puts(col, text, -1, attr);
|
grid_line_puts(col, text, -1, attr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *rt_leader = NULL;
|
char *rt_leader = NULL;
|
||||||
if (leader != NULL && curwin->w_p_rl) {
|
if (curwin->w_p_rl) {
|
||||||
rt_leader = reverse_text(leader);
|
rt_leader = reverse_text(leader);
|
||||||
}
|
}
|
||||||
char *match_leader = rt_leader != NULL ? rt_leader : leader;
|
char *match_leader = rt_leader != NULL ? rt_leader : leader;
|
||||||
size_t leader_len = match_leader ? strlen(match_leader) : 0;
|
size_t leader_len = strlen(match_leader);
|
||||||
|
|
||||||
const bool in_fuzzy = (get_cot_flags() & COT_FUZZY) != 0;
|
const bool in_fuzzy = (get_cot_flags() & COT_FUZZY) != 0;
|
||||||
|
|
||||||
garray_T *ga = NULL;
|
garray_T *ga = NULL;
|
||||||
if (match_leader != NULL && leader_len > 0 && in_fuzzy) {
|
if (in_fuzzy) {
|
||||||
ga = fuzzy_match_str_with_pos(text, match_leader);
|
ga = fuzzy_match_str_with_pos(text, match_leader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user