diff src/testdir/test_popupwin.vim @ 17767:c75da1064e33 v8.1.1880

patch 8.1.1880: cannot show extra info for completion in a popup window commit https://github.com/vim/vim/commit/576a4a6ff14da876d7c4418e5f27e926fcfa8d2a Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 18 15:25:17 2019 +0200 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'.
author Bram Moolenaar <Bram@vim.org>
date Sun, 18 Aug 2019 15:30:06 +0200
parents 65b89c9eb946
children b6c82748f9e1
line wrap: on
line diff
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -2193,4 +2193,76 @@ func Test_previewpopup()
   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