comparison 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
comparison
equal deleted inserted replaced
36150:e0d9e1d23e79 36151:610040fe16d0
5217 { 5217 {
5218 pos_T current_pos = *pos; 5218 pos_T current_pos = *pos;
5219 pos_T circly_end; 5219 pos_T circly_end;
5220 int found_new_match = FALSE; 5220 int found_new_match = FALSE;
5221 int looped_around = FALSE; 5221 int looped_around = FALSE;
5222 char_u *next_word_end = NULL;
5223 char_u *match_word = NULL;
5222 5224
5223 if (whole_line) 5225 if (whole_line)
5224 current_pos.lnum += dir; 5226 current_pos.lnum += dir;
5225 5227
5226 if (buf == curbuf) 5228 if (buf == curbuf)
5252 *ptr += current_pos.col; 5254 *ptr += current_pos.col;
5253 // Try to find a fuzzy match in the current line starting from current position 5255 // Try to find a fuzzy match in the current line starting from current position
5254 found_new_match = fuzzy_match_str_in_line(ptr, pattern, len, &current_pos); 5256 found_new_match = fuzzy_match_str_in_line(ptr, pattern, len, &current_pos);
5255 if (found_new_match) 5257 if (found_new_match)
5256 { 5258 {
5259 if (ctrl_x_mode_normal())
5260 {
5261 match_word = vim_strnsave(*ptr, *len);
5262 if (STRCMP(match_word, pattern) == 0)
5263 {
5264 next_word_end = find_word_start(*ptr + *len);
5265 if (*next_word_end != NUL && *next_word_end != NL)
5266 {
5267 // Find end of the word.
5268 if (has_mbyte)
5269 while (*next_word_end != NUL)
5270 {
5271 int l = (*mb_ptr2len)(next_word_end);
5272
5273 if (l < 2 && !vim_iswordc(*next_word_end))
5274 break;
5275 next_word_end += l;
5276 }
5277 else
5278 next_word_end = find_word_end(next_word_end);
5279 }
5280 else if (looped_around)
5281 found_new_match = FALSE;
5282
5283 *len = next_word_end - *ptr;
5284 current_pos.col = *len;
5285 }
5286 vim_free(match_word);
5287 }
5257 *pos = current_pos; 5288 *pos = current_pos;
5258 break; 5289 break;
5259 } 5290 }
5260 else if (looped_around && current_pos.lnum == circly_end.lnum) 5291 else if (looped_around && current_pos.lnum == circly_end.lnum)
5261 break; 5292 break;