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: #16284
closes: #16283
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index 8f053fa..729fbec 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -1715,11 +1715,15 @@
func Test_pum_matchins_highlight()
CheckScreendump
let lines =<< trim END
+ 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 ctermfg=red
@@ -1766,6 +1770,10 @@
call VerifyScreenDump(buf, 'Test_pum_matchins_10', {})
call term_sendkeys(buf, "\<Esc>")
+ call term_sendkeys(buf, ":let g:change=1\<CR>S\<C-X>\<C-O>")
+ call VerifyScreenDump(buf, 'Test_pum_matchins_11', {})
+ call term_sendkeys(buf, "\<Esc>")
+
call StopVimInTerminal(buf)
endfunc
@@ -1811,4 +1819,15 @@
call StopVimInTerminal(buf)
endfunc
+" this used to crash
+func Test_popup_completion_many_ctrlp()
+ new
+ let candidates=repeat(['a0'], 99)
+ call setline(1, candidates)
+ exe ":norm! VGg\<C-A>"
+ norm! G
+ call feedkeys("o" .. repeat("\<c-p>", 100), 'tx')
+ bw!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab