Mercurial > vim
diff src/testdir/test_popupwin.vim @ 18823:ae2bd5ec98d0 v8.1.2399
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Commit: https://github.com/vim/vim/commit/bef93ac9dbfb98193ddb315c50523f1af01a517d
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Dec 6 20:17:35 2019 +0100
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Problem: Info popup on top of cursor if it doesn't fit.
Solution: Hide the popup if it doesn't fit.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 06 Dec 2019 20:30:03 +0100 |
parents | 068337e86133 |
children | 9449ed2ee8d4 |
line wrap: on
line diff
--- a/src/testdir/test_popupwin.vim +++ b/src/testdir/test_popupwin.vim @@ -2982,6 +2982,58 @@ func Test_popupmenu_info_hidden() call delete('XtestInfoPopupHidden') endfunc +func Test_popupmenu_info_too_wide() + CheckScreendump + CheckFeature quickfix + + let lines =<< trim END + call setline(1, range(10)) + + set completeopt+=preview,popup + set completepopup=align:menu + set omnifunc=OmniFunc + hi InfoPopup ctermbg=lightgrey + + func OmniFunc(findstart, base) + if a:findstart + return 0 + endif + + let menuText = 'some long text to make sure the menu takes up all of the width of the window' + return #{ + \ words: [ + \ #{ + \ word: 'scrap', + \ menu: menuText, + \ info: "other words are\ncooler than this and some more text\nto make wrap", + \ }, + \ #{ + \ word: 'scappier', + \ menu: menuText, + \ info: 'words are cool', + \ }, + \ #{ + \ word: 'scrappier2', + \ menu: menuText, + \ info: 'words are cool', + \ }, + \ ] + \ } + endfunc + END + + call writefile(lines, 'XtestInfoPopupWide') + let buf = RunVimInTerminal('-S XtestInfoPopupWide', #{rows: 8}) + call term_wait(buf, 50) + + call term_sendkeys(buf, "Ascr\<C-X>\<C-O>") + call VerifyScreenDump(buf, 'Test_popupwin_infopopup_wide_1', {}) + + call term_sendkeys(buf, "\<Esc>") + call StopVimInTerminal(buf) + call delete('XtestInfoPopupWide') +endfunc + func Test_popupwin_recycle_bnr() let bufnr = popup_notification('nothing wrong', {})->winbufnr() call popup_clear()