patch 8.1.1880: cannot show extra info for completion in a popup window
Problem: Cannot show extra info for completion in a popup window.
Solution: Add the "popup" entry in 'completeopt'.
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index fbd32be..5de7255 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -2193,4 +2193,76 @@
call delete('Xheader.h')
endfunc
+func Test_popupmenu_info()
+ let lines =<< trim END
+ set completeopt+=preview,popup
+ set completefunc=CompleteFuncDict
+
+ func CompleteFuncDict(findstart, base)
+ if a:findstart
+ if col('.') > 10
+ return col('.') - 10
+ endif
+ return 0
+ endif
+
+ return {
+ \ 'words': [
+ \ {
+ \ 'word': 'aword',
+ \ 'abbr': 'wrd',
+ \ 'menu': 'extra text',
+ \ 'info': 'words are cool',
+ \ 'kind': 'W',
+ \ 'user_data': 'test'
+ \ },
+ \ {
+ \ 'word': 'anotherword',
+ \ 'abbr': 'anotwrd',
+ \ 'menu': 'extra text',
+ \ 'info': "other words are\ncooler than this and some more text\nto make wrap",
+ \ 'kind': 'W',
+ \ 'user_data': 'notest'
+ \ },
+ \ {
+ \ 'word': 'noinfo',
+ \ 'abbr': 'noawrd',
+ \ 'menu': 'extra text',
+ \ 'info': 'no words here',
+ \ 'kind': 'W',
+ \ 'user_data': 'notest'
+ \ },
+ \ {
+ \ 'word': 'thatword',
+ \ 'abbr': 'thatwrd',
+ \ 'menu': 'extra text',
+ \ 'info': 'that word is cool',
+ \ 'kind': 'W',
+ \ 'user_data': 'notest'
+ \ },
+ \ ]
+ \ }
+ endfunc
+ call setline(1, 'text text text text text text text ')
+ END
+ call writefile(lines, 'XtestInfoPopup')
+ let buf = RunVimInTerminal('-S XtestInfoPopup', #{rows: 14})
+ call term_wait(buf, 50)
+
+ call term_sendkeys(buf, "A\<C-X>\<C-U>")
+ call VerifyScreenDump(buf, 'Test_popupwin_infopopup_1', {})
+
+ call term_sendkeys(buf, "\<C-N>")
+ call VerifyScreenDump(buf, 'Test_popupwin_infopopup_2', {})
+
+ call term_sendkeys(buf, "\<C-N>")
+ call VerifyScreenDump(buf, 'Test_popupwin_infopopup_3', {})
+
+ call term_sendkeys(buf, "\<C-N>\<C-N>")
+ call VerifyScreenDump(buf, 'Test_popupwin_infopopup_4', {})
+
+ call StopVimInTerminal(buf)
+ call delete('XtestInfoPopup')
+endfunc
+
" vim: shiftwidth=2 sts=2