Mercurial > vim
diff src/search.c @ 36151:610040fe16d0 v9.1.0733
patch 9.1.0733: keyword completion does not work with fuzzy
Commit: https://github.com/vim/vim/commit/7cfe693f9bfa74690867e4d96c25f2205d0d13e4
Author: glepnir <glephunter@gmail.com>
Date: Sun Sep 15 20:06:28 2024 +0200
patch 9.1.0733: keyword completion does not work with fuzzy
Problem: keyword completion does not work with fuzzy
(egesip)
Solution: handle ctrl_x_mode_normal() specifically
(glepnir)
fixes: #15412
closes: #15424
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 15 Sep 2024 20:15:04 +0200 |
parents | 7e690bd1a27d |
children |
line wrap: on
line diff
--- a/src/search.c +++ b/src/search.c @@ -5219,6 +5219,8 @@ search_for_fuzzy_match( pos_T circly_end; int found_new_match = FALSE; int looped_around = FALSE; + char_u *next_word_end = NULL; + char_u *match_word = NULL; if (whole_line) current_pos.lnum += dir; @@ -5254,6 +5256,35 @@ search_for_fuzzy_match( found_new_match = fuzzy_match_str_in_line(ptr, pattern, len, ¤t_pos); if (found_new_match) { + if (ctrl_x_mode_normal()) + { + match_word = vim_strnsave(*ptr, *len); + if (STRCMP(match_word, pattern) == 0) + { + next_word_end = find_word_start(*ptr + *len); + if (*next_word_end != NUL && *next_word_end != NL) + { + // Find end of the word. + if (has_mbyte) + while (*next_word_end != NUL) + { + int l = (*mb_ptr2len)(next_word_end); + + if (l < 2 && !vim_iswordc(*next_word_end)) + break; + next_word_end += l; + } + else + next_word_end = find_word_end(next_word_end); + } + else if (looped_around) + found_new_match = FALSE; + + *len = next_word_end - *ptr; + current_pos.col = *len; + } + vim_free(match_word); + } *pos = current_pos; break; }