mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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
2e3cd52fa0
Co-authored-by: nwounkn <nwounkn@gmail.com>
This commit is contained in:
parent
35f475d0a5
commit
c9963e2212
@ -3635,7 +3635,7 @@ static int ins_compl_next(bool allow_get_expansion, int count, bool insert_match
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (allow_get_expansion && insert_match
|
if (allow_get_expansion && insert_match
|
||||||
&& (!(compl_get_longest || compl_restarting) || compl_used_match)) {
|
&& (!compl_get_longest || compl_used_match)) {
|
||||||
// Delete old text to be replaced
|
// Delete old text to be replaced
|
||||||
ins_compl_delete();
|
ins_compl_delete();
|
||||||
}
|
}
|
||||||
|
@ -864,7 +864,7 @@ func Test_complete_add_onechar()
|
|||||||
setlocal complete=.
|
setlocal complete=.
|
||||||
call setline(1, ['workhorse', 'workload'])
|
call setline(1, ['workhorse', 'workload'])
|
||||||
normal Go
|
normal Go
|
||||||
exe "normal aWOR\<C-P>\<bs>\<bs>\<bs>\<bs>\<bs>\<bs>\<C-L>r\<C-L>\<C-L>"
|
exe "normal aWOR\<C-P>\<bs>\<bs>\<bs>\<bs>\<bs>\<bs>\<C-L>\<C-L>\<C-L>"
|
||||||
call assert_equal('workh', getline(3))
|
call assert_equal('workh', getline(3))
|
||||||
set ignorecase& backspace&
|
set ignorecase& backspace&
|
||||||
close!
|
close!
|
||||||
@ -2280,6 +2280,17 @@ func GetCompleteInfo()
|
|||||||
return ''
|
return ''
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_completion_restart()
|
||||||
|
new
|
||||||
|
set complete=. completeopt=menuone backspace=2
|
||||||
|
call setline(1, 'workhorse workhorse')
|
||||||
|
exe "normal $a\<C-N>\<BS>\<BS>\<C-R>=GetCompleteInfo()\<CR>"
|
||||||
|
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()
|
func Test_complete_info_index()
|
||||||
new
|
new
|
||||||
call setline(1, ["aaa", "bbb", "ccc", "ddd", "eee", "fff"])
|
call setline(1, ["aaa", "bbb", "ccc", "ddd", "eee", "fff"])
|
||||||
|
Loading…
Reference in New Issue
Block a user