vim-patch:9.1.0956: completion may crash, completion highlight wrong with preview window

Problem:  completion may crash, completion highlight wrong with preview
          window (after v9.1.0954)
Solution: correctly calculate scroll offset, check for preview window
          when adding extra highlighting
          (glepnir)

when there have a preview window prepare_tagpreview
will change curwin to preview window and this may cause
ComplMatchIns check condition not correct. check wp is curwin
and also the type of wp is not a preview or poup info

fixes: https://github.com/vim/vim/issues/16284
closes: https://github.com/vim/vim/pull/16283

8d0bb6dc9f
This commit is contained in:
glepnir
2024-12-24 18:12:50 +08:00
committed by zeertzjq
parent a103ec7449
commit 05eca4c04d
5 changed files with 51 additions and 7 deletions

View File

@@ -5567,11 +5567,15 @@ describe('builtin popupmenu', function()
-- oldtest: Test_pum_matchins_highlight()
it('with ComplMatchIns highlight', function()
exec([[
let g:change = 0
func Omni_test(findstart, base)
if a:findstart
return col(".")
endif
return [#{word: "foo"}, #{word: "bar"}, #{word: "你好"}]
if g:change == 0
return [#{word: "foo"}, #{word: "bar"}, #{word: "你好"}]
endif
return [#{word: "foo", info: "info"}, #{word: "bar"}, #{word: "你好"}]
endfunc
set omnifunc=Omni_test
hi ComplMatchIns guifg=red
@@ -5663,6 +5667,21 @@ describe('builtin popupmenu', function()
{2:-- INSERT --} |
]])
feed('<Esc>')
feed(':let g:change=1<CR>S<C-X><C-O>')
screen:expect([[
info |
{1:~ }|*2
{3:[Scratch] [Preview] }|
{8:foo}^ |
{s:foo }{1: }|
{n:bar }{1: }|
{n:你好 }{1: }|
{1:~ }|*10
{4:[No Name] [+] }|
{2:-- }{5:match 1 of 3} |
]])
feed('<Esc>')
end)
-- oldtest: Test_pum_matchins_highlight_combine()