Mercurial > vim
comparison src/testdir/test_ins_complete.vim @ 33589:efe4751b93b1 v9.0.2039
patch 9.0.2039: completion shows current word after completion restart
Commit: https://github.com/vim/vim/commit/2e3cd52fa02b1a208c97992b1bca3b04f7be66d4
Author: nwounkn <nwounkn@gmail.com>
Date: Tue Oct 17 11:05:38 2023 +0200
patch 9.0.2039: completion shows current word after completion restart
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: #13349
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: nwounkn <nwounkn@gmail.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 17 Oct 2023 11:15:08 +0200 |
parents | 59879206a13d |
children | 021e5bb88513 |
comparison
equal
deleted
inserted
replaced
33588:56b56b8ed207 | 33589:efe4751b93b1 |
---|---|
816 %d | 816 %d |
817 set ignorecase backspace=2 | 817 set ignorecase backspace=2 |
818 setlocal complete=. | 818 setlocal complete=. |
819 call setline(1, ['workhorse', 'workload']) | 819 call setline(1, ['workhorse', 'workload']) |
820 normal Go | 820 normal Go |
821 exe "normal aWOR\<C-P>\<bs>\<bs>\<bs>\<bs>\<bs>\<bs>\<C-L>r\<C-L>\<C-L>" | 821 exe "normal aWOR\<C-P>\<bs>\<bs>\<bs>\<bs>\<bs>\<bs>\<C-L>\<C-L>\<C-L>" |
822 call assert_equal('workh', getline(3)) | 822 call assert_equal('workh', getline(3)) |
823 set ignorecase& backspace& | 823 set ignorecase& backspace& |
824 close! | 824 close! |
825 endfunc | 825 endfunc |
826 | 826 |
2246 func GetCompleteInfo() | 2246 func GetCompleteInfo() |
2247 let g:compl_info = complete_info() | 2247 let g:compl_info = complete_info() |
2248 return '' | 2248 return '' |
2249 endfunc | 2249 endfunc |
2250 | 2250 |
2251 func Test_completion_restart() | |
2252 new | |
2253 set complete=. completeopt=menuone backspace=2 | |
2254 call setline(1, 'workhorse workhorse') | |
2255 exe "normal $a\<C-N>\<BS>\<BS>\<C-R>=GetCompleteInfo()\<CR>" | |
2256 call assert_equal(1, len(g:compl_info['items'])) | |
2257 call assert_equal('workhorse', g:compl_info['items'][0]['word']) | |
2258 set complete& completeopt& backspace& | |
2259 bwipe! | |
2260 endfunc | |
2261 | |
2251 func Test_complete_info_index() | 2262 func Test_complete_info_index() |
2252 new | 2263 new |
2253 call setline(1, ["aaa", "bbb", "ccc", "ddd", "eee", "fff"]) | 2264 call setline(1, ["aaa", "bbb", "ccc", "ddd", "eee", "fff"]) |
2254 inoremap <buffer><F5> <C-R>=GetCompleteInfo()<CR> | 2265 inoremap <buffer><F5> <C-R>=GetCompleteInfo()<CR> |
2255 | 2266 |