forked from aniani/vim
patch 9.1.0489: default completion may break with fuzzy
Problem: default completion may break with fuzzy Solution: check that completion_match_array is not null (glepnir) closes: #15010 Signed-off-by: glepnir <glephunter@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
parent
a2324373eb
commit
aced8c2f4f
@ -4155,8 +4155,8 @@ find_next_completion_match(
|
|||||||
{
|
{
|
||||||
if (compl_shows_dir_forward() && compl_shown_match->cp_next != NULL)
|
if (compl_shows_dir_forward() && compl_shown_match->cp_next != NULL)
|
||||||
{
|
{
|
||||||
compl_shown_match = !compl_fuzzy_match ? compl_shown_match->cp_next
|
compl_shown_match = compl_fuzzy_match && compl_match_array != NULL
|
||||||
: find_comp_when_fuzzy();
|
? find_comp_when_fuzzy() : compl_shown_match->cp_next;
|
||||||
found_end = (compl_first_match != NULL
|
found_end = (compl_first_match != NULL
|
||||||
&& (is_first_match(compl_shown_match->cp_next)
|
&& (is_first_match(compl_shown_match->cp_next)
|
||||||
|| is_first_match(compl_shown_match)));
|
|| is_first_match(compl_shown_match)));
|
||||||
@ -4165,8 +4165,8 @@ find_next_completion_match(
|
|||||||
&& compl_shown_match->cp_prev != NULL)
|
&& compl_shown_match->cp_prev != NULL)
|
||||||
{
|
{
|
||||||
found_end = is_first_match(compl_shown_match);
|
found_end = is_first_match(compl_shown_match);
|
||||||
compl_shown_match = !compl_fuzzy_match ? compl_shown_match->cp_prev
|
compl_shown_match = compl_fuzzy_match && compl_match_array != NULL
|
||||||
: find_comp_when_fuzzy();
|
? find_comp_when_fuzzy() : compl_shown_match->cp_prev;
|
||||||
found_end |= is_first_match(compl_shown_match);
|
found_end |= is_first_match(compl_shown_match);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2573,6 +2573,16 @@ func Test_complete_fuzzy_match()
|
|||||||
call feedkeys("S\<C-x>\<C-o>fb\<C-n>", 'tx')
|
call feedkeys("S\<C-x>\<C-o>fb\<C-n>", 'tx')
|
||||||
call assert_equal('fooBaz', g:word)
|
call assert_equal('fooBaz', g:word)
|
||||||
|
|
||||||
|
" avoid break default completion behavior
|
||||||
|
set completeopt=fuzzy,menu
|
||||||
|
call setline(1, ['hello help hero h'])
|
||||||
|
exe "norm! A\<C-X>\<C-N>"
|
||||||
|
call assert_equal('hello help hero hello', getline('.'))
|
||||||
|
set completeopt+=noinsert
|
||||||
|
call setline(1, ['hello help hero h'])
|
||||||
|
exe "norm! A\<C-X>\<C-N>"
|
||||||
|
call assert_equal('hello help hero h', getline('.'))
|
||||||
|
|
||||||
" clean up
|
" clean up
|
||||||
set omnifunc=
|
set omnifunc=
|
||||||
bw!
|
bw!
|
||||||
|
@ -704,6 +704,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
489,
|
||||||
/**/
|
/**/
|
||||||
488,
|
488,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user