To: vim_dev@googlegroups.com Subject: Patch 8.1.2399 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2399 Problem: Info popup on top of cursor if it doesn't fit. Solution: Hide the popup if it doesn't fit. Files: src/popupmenu.c, src/testdir/test_popupwin.vim, src/testdir/dumps/Test_popupwin_infopopup_wide_1.dump *** ../vim-8.1.2398/src/popupmenu.c 2019-12-05 21:10:33.723533573 +0100 --- src/popupmenu.c 2019-12-06 19:41:12.598077740 +0100 *************** *** 661,667 **** // align with the selected item row += pum_selected - pum_first + 1; ! popup_set_wantpos_rowcol(wp, row, col); } #endif --- 661,673 ---- // align with the selected item row += pum_selected - pum_first + 1; ! wp->w_popup_flags &= ~POPF_HIDDEN; ! if (wp->w_maxwidth < 10) ! // The popup is not going to fit or will overlap with the cursor ! // position, hide the popup. ! wp->w_popup_flags |= POPF_HIDDEN; ! else ! popup_set_wantpos_rowcol(wp, row, col); } #endif *** ../vim-8.1.2398/src/testdir/test_popupwin.vim 2019-12-01 15:23:07.472344471 +0100 --- src/testdir/test_popupwin.vim 2019-12-06 20:07:12.581056207 +0100 *************** *** 2982,2987 **** --- 2982,3039 ---- 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\\") + call VerifyScreenDump(buf, 'Test_popupwin_infopopup_wide_1', {}) + + call term_sendkeys(buf, "\") + call StopVimInTerminal(buf) + call delete('XtestInfoPopupWide') + endfunc + func Test_popupwin_recycle_bnr() let bufnr = popup_notification('nothing wrong', {})->winbufnr() call popup_clear() *** ../vim-8.1.2398/src/testdir/dumps/Test_popupwin_infopopup_wide_1.dump 2019-12-06 20:17:05.675143874 +0100 --- src/testdir/dumps/Test_popupwin_infopopup_wide_1.dump 2019-12-06 20:07:18.025039635 +0100 *************** *** 0 **** --- 1,8 ---- + |s+0&#ffffff0|c|r|a|p> @69 + |s+0#0000001#e0e0e08|c|r|a|p| @5|s|o|m|e| |l|o|n|g| |t|e|x|t| |t|o| |m|a|k|e| |s|u|r|e| |t|h|e| |m|e|n|u| |t|a|k|e|s| |u|p| |a|l@1| |o|f| |t|h|e| |w|i|d|t|h| |o + |s+0&#ffd7ff255|c|a|p@1|i|e|r| @2|s|o|m|e| |l|o|n|g| |t|e|x|t| |t|o| |m|a|k|e| |s|u|r|e| |t|h|e| |m|e|n|u| |t|a|k|e|s| |u|p| |a|l@1| |o|f| |t|h|e| |w|i|d|t|h| |o + |s|c|r|a|p@1|i|e|r|2| |s|o|m|e| |l|o|n|g| |t|e|x|t| |t|o| |m|a|k|e| |s|u|r|e| |t|h|e| |m|e|n|u| |t|a|k|e|s| |u|p| |a|l@1| |o|f| |t|h|e| |w|i|d|t|h| |o + |4+0#0000000#ffffff0| @73 + |5| @73 + |6| @73 + |-+2&&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |3| +0#0000000&@34 *** ../vim-8.1.2398/src/version.c 2019-12-06 12:44:57.992719138 +0100 --- src/version.c 2019-12-06 19:42:19.017843093 +0100 *************** *** 744,745 **** --- 744,747 ---- { /* Add new patch number below this line */ + /**/ + 2399, /**/ -- hundred-and-one symptoms of being an internet addict: 202. You're amazed to find out Spam is a food. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///