patch 9.1.1381: completion: cannot return to original text Commit: https://github.com/vim/vim/commit/5a18ccf49007481b1fffcf101e4ce0b36a2db241 Author: glepnir <glephun...@gmail.com> Date: Sun May 11 13:48:33 2025 +0200
patch 9.1.1381: completion: cannot return to original text Problem: Cannot return to the original text after selecting the next item when the currently selected item is the last one. Solution: When continuing to move down past the last item, locate the original completion at the head/tail nodes of the completed linked list (glepnir). closes: #17300 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 7bbff4ecb..bb280fa46 100644 --- a/src/insexpand.c +++ b/src/insexpand.c @@ -5236,9 +5236,8 @@ find_comp_when_fuzzy(void) if ((is_forward && compl_selected_item == compl_match_arraysize - 1) || (is_backward && compl_selected_item == 0)) - return compl_first_match != compl_shown_match ? - (is_forward ? compl_shown_match->cp_next : compl_first_match) : - (compl_first_match->cp_prev ? compl_first_match->cp_prev : NULL); + return match_at_original_text(compl_first_match) + ? compl_first_match : compl_first_match->cp_prev; if (is_forward) target_idx = compl_selected_item + 1; diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim index 6f342ae46..f7292ea34 100644 --- a/src/testdir/test_ins_complete.vim +++ b/src/testdir/test_ins_complete.vim @@ -3387,11 +3387,15 @@ func Test_complete_opt_fuzzy() autocmd CompleteChanged * :call OnPumChange() augroup END + let g:change = 0 func Omni_test(findstart, base) if a:findstart return col(".") endif - return [#{word: "foo"}, #{word: "foobar"}, #{word: "fooBaz"}, #{word: "foobala"}, #{word: "你好吗"}, #{word: "我好"}] + if g:change == 0 + return [#{word: "foo"}, #{word: "foobar"}, #{word: "fooBaz"}, #{word: "foobala"}, #{word: "你好吗"}, #{word: "我好"}] + endif + return [#{word: "for i = .."}, #{word: "bar"}, #{word: "foo"}, #{word: "for .. ipairs"}, #{word: "for .. pairs"}] endfunc new @@ -3488,6 +3492,15 @@ func Test_complete_opt_fuzzy() call feedkeys("Salpha bravio charlie\<CR>alpha\<C-X>\<C-N>\<C-X>\<C-N>\<C-X>\<C-N>\<ESC>", 'tx') call assert_equal('alpha bravio charlie', getline('.')) + set cot=fuzzy,menu,noinsert + call feedkeys(":let g:change=1\<CR>") + call feedkeys("S\<C-X>\<C-O>for\<C-N>\<C-N>\<C-N>", 'tx') + call assert_equal('for', getline('.')) + call feedkeys("S\<C-X>\<C-O>for\<C-P>", 'tx') + call assert_equal('for', getline('.')) + call feedkeys("S\<C-X>\<C-O>for\<C-P>\<C-P>", 'tx') + call assert_equal('for .. ipairs', getline('.')) + " clean up set omnifunc= bw! diff --git a/src/version.c b/src/version.c index aa4bc198e..449a358b6 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 */ +/**/ + 1381, /**/ 1380, /**/ -- -- 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 visit https://groups.google.com/d/msgid/vim_dev/E1uE5Li-003uc6-2L%40256bit.org.