static void ins_compl_longest_match(compl_T *match);
static void ins_compl_del_pum(void);
static void ins_compl_files(int count, char_u **files, int thesaurus, int flags, regmatch_T *regmatch, char_u *buf, int *dir);
-static char_u *find_line_end(char_u *ptr);
static void ins_compl_free(void);
static int ins_compl_need_restart(void);
static void ins_compl_new_leader(void);
&& score == compl_first_match->cp_next->cp_score)
compl_num_bests++;
}
- else if (find_word_end(ptr) == line_end)
- break;
}
}
line_breakcheck();
* Find the end of the line, omitting CR and NL at the end.
* Returns a pointer to just after the line.
*/
- static char_u *
+ char_u *
find_line_end(char_u *ptr)
{
char_u *s;
void free_insexpand_stuff(void);
int ins_compl_preinsert_effect(void);
int ins_compl_lnum_in_range(linenr_T lnum);
+char_u *find_line_end(char_u *ptr);
+
/* vim: set ft=c : */
* - `*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.
*/
int
fuzzy_match_str_in_line(
char_u *start = NULL;
int found = FALSE;
char save_end;
+ char_u *line_end = NULL;
if (str == NULL || pat == NULL)
return found;
+ line_end = find_line_end(str);
- while (*str != NUL)
+ while (str < line_end)
{
// Skip non-word characters
start = find_word_start(str);
MB_PTR_ADV(str);
}
+ if (!found)
+ *ptr = line_end;
+
return found;
}
call writefile([' auto int enum register', 'why'], 'test_case4.txt', 'D')
exe "normal ggdGSe\<C-N>\<C-N>\<ESC>"
call assert_equal("enum", getline('.'))
+
+ set complete=ktest_case5.txt
+ call writefile(['hello friends', 'go', 'hero'], 'test_case5.txt', 'D')
+ exe "normal ggdGSh\<C-N>\<C-N>\<ESC>"
+ call assert_equal("hero", getline('.'))
set complete&
" file
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1185,
/**/
1184,
/**/