From c9963e2212bda7a4d2186469ad07078d348353cf Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 17 Oct 2023 17:49:22 +0800 Subject: vim-patch:9.0.2039: completion shows current word after completion restart (#25682) Problem: completion shows current word after completion restart Solution: remove the word being completed after completion restart The word being completed is shown in a completion list after completion restart, because it isn't removed from the current buffer before searching for matches. Also adjust `Test_complete_add_onechar` to match the new behavior. closes: vim/vim#13349 https://github.com/vim/vim/commit/2e3cd52fa02b1a208c97992b1bca3b04f7be66d4 Co-authored-by: nwounkn --- test/old/testdir/test_ins_complete.vim | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index aeceeea9f1..ec5fd186b1 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -864,7 +864,7 @@ func Test_complete_add_onechar() setlocal complete=. call setline(1, ['workhorse', 'workload']) normal Go - exe "normal aWOR\\\\\\\\r\\" + exe "normal aWOR\\\\\\\\\\" call assert_equal('workh', getline(3)) set ignorecase& backspace& close! @@ -2280,6 +2280,17 @@ func GetCompleteInfo() return '' endfunc +func Test_completion_restart() + new + set complete=. completeopt=menuone backspace=2 + call setline(1, 'workhorse workhorse') + exe "normal $a\\\\=GetCompleteInfo()\" + call assert_equal(1, len(g:compl_info['items'])) + call assert_equal('workhorse', g:compl_info['items'][0]['word']) + set complete& completeopt& backspace& + bwipe! +endfunc + func Test_complete_info_index() new call setline(1, ["aaa", "bbb", "ccc", "ddd", "eee", "fff"]) -- cgit