Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
18822:671d8678b0e7 | 18823:ae2bd5ec98d0 |
---|---|
2980 call term_sendkeys(buf, "\<Esc>") | 2980 call term_sendkeys(buf, "\<Esc>") |
2981 call StopVimInTerminal(buf) | 2981 call StopVimInTerminal(buf) |
2982 call delete('XtestInfoPopupHidden') | 2982 call delete('XtestInfoPopupHidden') |
2983 endfunc | 2983 endfunc |
2984 | 2984 |
2985 func Test_popupmenu_info_too_wide() | |
2986 CheckScreendump | |
2987 CheckFeature quickfix | |
2988 | |
2989 let lines =<< trim END | |
2990 call setline(1, range(10)) | |
2991 | |
2992 set completeopt+=preview,popup | |
2993 set completepopup=align:menu | |
2994 set omnifunc=OmniFunc | |
2995 hi InfoPopup ctermbg=lightgrey | |
2996 | |
2997 func OmniFunc(findstart, base) | |
2998 if a:findstart | |
2999 return 0 | |
3000 endif | |
3001 | |
3002 let menuText = 'some long text to make sure the menu takes up all of the width of the window' | |
3003 return #{ | |
3004 \ words: [ | |
3005 \ #{ | |
3006 \ word: 'scrap', | |
3007 \ menu: menuText, | |
3008 \ info: "other words are\ncooler than this and some more text\nto make wrap", | |
3009 \ }, | |
3010 \ #{ | |
3011 \ word: 'scappier', | |
3012 \ menu: menuText, | |
3013 \ info: 'words are cool', | |
3014 \ }, | |
3015 \ #{ | |
3016 \ word: 'scrappier2', | |
3017 \ menu: menuText, | |
3018 \ info: 'words are cool', | |
3019 \ }, | |
3020 \ ] | |
3021 \ } | |
3022 endfunc | |
3023 END | |
3024 | |
3025 call writefile(lines, 'XtestInfoPopupWide') | |
3026 let buf = RunVimInTerminal('-S XtestInfoPopupWide', #{rows: 8}) | |
3027 call term_wait(buf, 50) | |
3028 | |
3029 call term_sendkeys(buf, "Ascr\<C-X>\<C-O>") | |
3030 call VerifyScreenDump(buf, 'Test_popupwin_infopopup_wide_1', {}) | |
3031 | |
3032 call term_sendkeys(buf, "\<Esc>") | |
3033 call StopVimInTerminal(buf) | |
3034 call delete('XtestInfoPopupWide') | |
3035 endfunc | |
3036 | |
2985 func Test_popupwin_recycle_bnr() | 3037 func Test_popupwin_recycle_bnr() |
2986 let bufnr = popup_notification('nothing wrong', {})->winbufnr() | 3038 let bufnr = popup_notification('nothing wrong', {})->winbufnr() |
2987 call popup_clear() | 3039 call popup_clear() |
2988 let winid = 'nothing wrong'->popup_notification({}) | 3040 let winid = 'nothing wrong'->popup_notification({}) |
2989 call assert_equal(bufnr, winbufnr(winid)) | 3041 call assert_equal(bufnr, winbufnr(winid)) |