patch 9.1.0489: default completion may break with fuzzy Commit: https://github.com/vim/vim/commit/aced8c2f4fd1cf3f8ac7cdb0dd54d19ef4390ef8 Author: glepnir <glephun...@gmail.com> Date: Sat Jun 15 15:13:05 2024 +0200
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 <glephun...@gmail.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/src/insexpand.c b/src/insexpand.c index 7b9a5116d..e31274165 100644 --- a/src/insexpand.c +++ b/src/insexpand.c @@ -4155,8 +4155,8 @@ find_next_completion_match( { if (compl_shows_dir_forward() && compl_shown_match->cp_next != NULL) { - compl_shown_match = !compl_fuzzy_match ? compl_shown_match->cp_next - : find_comp_when_fuzzy(); + compl_shown_match = compl_fuzzy_match && compl_match_array != NULL + ? find_comp_when_fuzzy() : compl_shown_match->cp_next; found_end = (compl_first_match != NULL && (is_first_match(compl_shown_match->cp_next) || is_first_match(compl_shown_match))); @@ -4165,8 +4165,8 @@ find_next_completion_match( && compl_shown_match->cp_prev != NULL) { found_end = is_first_match(compl_shown_match); - compl_shown_match = !compl_fuzzy_match ? compl_shown_match->cp_prev - : find_comp_when_fuzzy(); + compl_shown_match = compl_fuzzy_match && compl_match_array != NULL + ? find_comp_when_fuzzy() : compl_shown_match->cp_prev; found_end |= is_first_match(compl_shown_match); } else diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim index 9f689fefe..51e3c1b5b 100644 --- a/src/testdir/test_ins_complete.vim +++ b/src/testdir/test_ins_complete.vim @@ -2573,6 +2573,16 @@ func Test_complete_fuzzy_match() call feedkeys("S\<C-x>\<C-o>fb\<C-n>", 'tx') 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 set omnifunc= bw! diff --git a/src/version.c b/src/version.c index 61532287d..f153bfb07 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 489, /**/ 488, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/E1sITTn-00EVYX-2E%40256bit.org.