mirror of
https://github.com/neovim/neovim.git
synced 2025-10-16 06:46:07 +00:00
vim-patch:9.1.1185: endless loop with completefuzzycollect and no match found
Problem: endless loop with completefuzzycollect and no match found
Solution: move pointer to line end and break loop
closes: vim/vim#16820
dd42b05f8a
Co-authored-by: glepnir <glephunter@gmail.com>
This commit is contained in:
@@ -3629,8 +3629,7 @@ garray_T *fuzzy_match_str_with_pos(char *const str, const char *const pat)
|
||||
/// - `*len` is set to the length of the matched word.
|
||||
/// - `*score` contains the match score.
|
||||
///
|
||||
/// If no match is found, `*ptr` is updated to point beyond the last word
|
||||
/// or to the end of the line.
|
||||
/// If no match is found, `*ptr` is updated to to the end of the line.
|
||||
bool fuzzy_match_str_in_line(char **ptr, char *pat, int *len, pos_T *current_pos, int *score)
|
||||
{
|
||||
char *str = *ptr;
|
||||
@@ -3642,8 +3641,9 @@ bool fuzzy_match_str_in_line(char **ptr, char *pat, int *len, pos_T *current_pos
|
||||
if (str == NULL || pat == NULL) {
|
||||
return found;
|
||||
}
|
||||
char *line_end = find_line_end(str);
|
||||
|
||||
while (*str != NUL) {
|
||||
while (str < line_end) {
|
||||
// Skip non-word characters
|
||||
start = find_word_start(str);
|
||||
if (*start == NUL) {
|
||||
@@ -3677,6 +3677,10 @@ bool fuzzy_match_str_in_line(char **ptr, char *pat, int *len, pos_T *current_pos
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
*ptr = line_end;
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user