comparison src/testdir/test_popupwin.vim @ 17354:102ed3a26a5d v8.1.1676

patch 8.1.1676: "maxwidth" of popup window does not always work properly commit https://github.com/vim/vim/commit/017c2699381be17131a02f051ecb812067289856 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 13 14:17:51 2019 +0200 patch 8.1.1676: "maxwidth" of popup window does not always work properly Problem: "maxwidth" of popup window does not always work properly. Solution: Adjust the computation. (Naruhiko Nishino, closes https://github.com/vim/vim/issues/4653)
author Bram Moolenaar <Bram@vim.org>
date Sat, 13 Jul 2019 14:30:05 +0200
parents d82b0cfb1e82
children d1ea88736ebd
comparison
equal deleted inserted replaced
17353:c8a1757026ed 17354:102ed3a26a5d
1817 call assert_equal(1, bufinfo.loaded) 1817 call assert_equal(1, bufinfo.loaded)
1818 call assert_equal([], bufinfo.windows) 1818 call assert_equal([], bufinfo.windows)
1819 call assert_equal([], bufinfo.popups) 1819 call assert_equal([], bufinfo.popups)
1820 exe 'bwipe! ' .. buf 1820 exe 'bwipe! ' .. buf
1821 endfunc 1821 endfunc
1822
1823 func Test_popup_menu_with_maxwidth()
1824 if !CanRunVimInTerminal()
1825 throw 'Skipped: cannot make screendumps'
1826 endif
1827
1828 let lines =<< trim END
1829 call setline(1, range(1, 10))
1830 hi ScrollThumb ctermbg=blue
1831 hi ScrollBar ctermbg=red
1832 func PopupMenu(lines, line, col, scrollbar = 0)
1833 return popup_menu(a:lines, {
1834 \ 'maxwidth': 10,
1835 \ 'maxheight': 3,
1836 \ 'pos' : 'topleft',
1837 \ 'col' : a:col,
1838 \ 'line' : a:line,
1839 \ 'scrollbar' : a:scrollbar,
1840 \ })
1841 endfunc
1842 call PopupMenu(['x'], 1, 1)
1843 call PopupMenu(['123456789|'], 1, 16)
1844 call PopupMenu(['123456789|' .. ' '], 7, 1)
1845 call PopupMenu([repeat('123456789|', 100)], 7, 16)
1846 call PopupMenu(repeat(['123456789|' .. ' '], 5), 1, 33, 1)
1847 END
1848 call writefile(lines, 'XtestPopupMenuMaxWidth')
1849 let buf = RunVimInTerminal('-S XtestPopupMenuMaxWidth', {'rows': 13})
1850 call VerifyScreenDump(buf, 'Test_popupwin_menu_maxwidth_1', {})
1851
1852 " close the menu popupwin.
1853 call term_sendkeys(buf, " ")
1854 call term_sendkeys(buf, " ")
1855 call term_sendkeys(buf, " ")
1856 call term_sendkeys(buf, " ")
1857 call term_sendkeys(buf, " ")
1858
1859 " clean up
1860 call StopVimInTerminal(buf)
1861 call delete('XtestPopupMenuMaxWidth')
1862 endfunc
1863
1864 " vim: shiftwidth=2 sts=2 expandtab