Mercurial > vim
diff src/testdir/test_popupwin.vim @ 17438:967e2ee9b656 v8.1.1717
patch 8.1.1717: last char in menu popup window highlighted
commit https://github.com/vim/vim/commit/f914a33c9c8ec5c30da684a4a16edad3e0224f0a
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jul 20 15:09:56 2019 +0200
patch 8.1.1717: last char in menu popup window highlighted
Problem: Last char in menu popup window highlighted.
Solution: Do not highlight an extra character twice.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 20 Jul 2019 15:15:05 +0200 |
parents | 6e756ad5ef1a |
children | 57b9fca8c7d2 |
line wrap: on
line diff
--- a/src/testdir/test_popupwin.vim +++ b/src/testdir/test_popupwin.vim @@ -1215,6 +1215,29 @@ func Test_popup_menu_screenshot() call delete('XtestPopupMenu') endfunc +func Test_popup_menu_narrow() + if !CanRunVimInTerminal() + throw 'Skipped: cannot make screendumps' + endif + + let lines =<< trim END + call setline(1, range(1, 20)) + hi PopupSelected ctermbg=green + call popup_menu(['one', 'two', 'three'], #{callback: 'MenuDone'}) + func MenuDone(id, res) + echomsg "selected " .. a:res + endfunc + END + call writefile(lines, 'XtestPopupNarrowMenu') + let buf = RunVimInTerminal('-S XtestPopupNarrowMenu', #{rows: 10}) + call VerifyScreenDump(buf, 'Test_popupwin_menu_04', {}) + + " clean up + call term_sendkeys(buf, "x") + call StopVimInTerminal(buf) + call delete('XtestPopupNarrowMenu') +endfunc + func Test_popup_title() if !CanRunVimInTerminal() throw 'Skipped: cannot make screendumps' @@ -2093,4 +2116,50 @@ func Test_popup_cursorline() call delete('XtestPopupCursorLine') endfunc +func Test_previewpopup() + if !CanRunVimInTerminal() + throw 'Skipped: cannot make screendumps' + endif + call writefile([ + \ "!_TAG_FILE_ENCODING\tutf-8\t//", + \ "another\tXtagfile\t/^this is another", + \ "theword\tXtagfile\t/^theword"], + \ 'Xtags') + call writefile(range(1,20) + \ + ['theword is here'] + \ + range(22, 27) + \ + ['this is another place'] + \ + range(29, 40), + \ "Xtagfile") + let lines =<< trim END + set tags=Xtags + call setline(1, [ + \ 'one', + \ 'two', + \ 'three', + \ 'four', + \ 'five', + \ 'six', + \ 'seven', + \ 'find theword somewhere', + \ 'nine', + \ 'this is another word']) + set previewpopup=height:4,width:40 + END + call writefile(lines, 'XtestPreviewPopup') + let buf = RunVimInTerminal('-S XtestPreviewPopup', #{rows: 14}) + + call term_sendkeys(buf, "/theword\<CR>\<C-W>}") + call term_sendkeys(buf, ":\<CR>") + call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_1', {}) + + call term_sendkeys(buf, "/another\<CR>\<C-W>}") + call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_2', {}) + + call StopVimInTerminal(buf) + call delete('Xtags') + call delete('Xtagfile') + call delete('XtestPreviewPopup') +endfunc + " vim: shiftwidth=2 sts=2 expandtab