mirror of
https://github.com/neovim/neovim.git
synced 2026-08-27 01:21:48 +00:00
vim-patch:9.2.0040: completion: preinsert wrong with register completion (#38003)
Problem: completion: preinsert wrong with register completion
Solution: Remove preinserted text during register content insertion
(Girish Palya).
fixes: vim/vim#19329
closes: vim/vim#19474
3684ad83d1
Co-authored-by: Girish Palya <girishji@gmail.com>
This commit is contained in:
@@ -6378,4 +6378,26 @@ func Test_autocomplete_preinsert_null_leader()
|
||||
delfunc GetState
|
||||
endfunc
|
||||
|
||||
" Issue #19329: When register contents are inserted, remove preinserted text
|
||||
func Test_ins_register_preinsert_autocomplete()
|
||||
func TestOmni(findstart, base)
|
||||
if a:findstart
|
||||
return col(".") - 1
|
||||
endif
|
||||
return ["foo", "foobar"]
|
||||
endfunc
|
||||
|
||||
call Ntest_override("char_avail", 1)
|
||||
new
|
||||
set omnifunc=TestOmni complete^=o
|
||||
set completeopt=preinsert autocomplete
|
||||
|
||||
call feedkeys("ifoo \<C-R>\<C-P>=\"xyz\"\<CR>\<Esc>", 'tx')
|
||||
call assert_equal("foo xyz", getline('.'))
|
||||
bw!
|
||||
set omnifunc& complete& completeopt& autocomplete&
|
||||
call Ntest_override("char_avail", 0)
|
||||
delfunc TestOmni
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab nofoldenable
|
||||
|
||||
Reference in New Issue
Block a user