comparison src/testdir/test_popupwin.vim @ 29032:361b46a07f5e v8.2.5038

patch 8.2.5038: a finished terminal in a popup window does not show scrollbar Commit: https://github.com/vim/vim/commit/d28950f9540f77032cee0a3047b05bef50ea81dc Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 29 14:13:04 2022 +0100 patch 8.2.5038: a finished terminal in a popup window does not show scrollbar Problem: A finished terminal in a popup window does not show a scrollbar. Solution: Show the scrollbar if the terminal job is finished. (closes #10497)
author Bram Moolenaar <Bram@vim.org>
date Sun, 29 May 2022 15:15:05 +0200
parents a8c2bd5fc727
children f3c014fe5c16
comparison
equal deleted inserted replaced
29031:fc57c55a63a4 29032:361b46a07f5e
2854 " Cannot open a second one. 2854 " Cannot open a second one.
2855 let termbuf2 = term_start(&shell, #{hidden: 1}) 2855 let termbuf2 = term_start(&shell, #{hidden: 1})
2856 call assert_fails('call popup_create(termbuf2, #{})', 'E861:') 2856 call assert_fails('call popup_create(termbuf2, #{})', 'E861:')
2857 call term_sendkeys(termbuf2, "exit\<CR>") 2857 call term_sendkeys(termbuf2, "exit\<CR>")
2858 2858
2859 " Exiting shell closes popup window 2859 " Exiting shell puts popup window in Terminal-Normal mode.
2860 call feedkeys("exit\<CR>", 'xt') 2860 call feedkeys("exit\<CR>", 'xt')
2861 " Wait for shell to exit 2861 " Wait for shell to exit
2862 call WaitForAssert({-> assert_equal("dead", job_status(term_getjob(termbuf)))}) 2862 call WaitForAssert({-> assert_equal("dead", job_status(term_getjob(termbuf)))})
2863 2863
2864 helpclose 2864 helpclose
2865 call feedkeys(":quit\<CR>", 'xt') 2865 call feedkeys(":quit\<CR>", 'xt')
2866 call assert_equal(origwin, win_getid()) 2866 call assert_equal(origwin, win_getid())
2867 endfunc
2868
2869 func Test_popupwin_terminal_scrollbar()
2870 CheckFeature terminal
2871 CheckScreendump
2872 CheckUnix
2873
2874 call writefile(range(50), 'Xtestfile')
2875 let lines =<< trim END
2876 vim9script
2877
2878 term_start(['cat', 'Xtestfile'], {hidden: true})
2879 ->popup_create({
2880 minwidth: 40,
2881 maxwidth: 40,
2882 minheight: 8,
2883 maxheight: 8,
2884 scrollbar: true,
2885 border: []
2886 })
2887 END
2888 call writefile(lines, 'Xpterm')
2889 let buf = RunVimInTerminal('-S Xpterm', #{rows: 15})
2890 call VerifyScreenDump(buf, 'Test_popupwin_poptermscroll_1', {})
2891
2892 " scroll to the middle
2893 call term_sendkeys(buf, "50%")
2894 call VerifyScreenDump(buf, 'Test_popupwin_poptermscroll_2', {})
2895
2896 " close the popupwin.
2897 call term_sendkeys(buf, ":q\<CR>")
2898 call VerifyScreenDump(buf, 'Test_popupwin_poptermscroll_3', {})
2899
2900 call StopVimInTerminal(buf)
2901 call delete('Xtestfile')
2902 call delete('Xpterm')
2867 endfunc 2903 endfunc
2868 2904
2869 func Test_popupwin_close_prevwin() 2905 func Test_popupwin_close_prevwin()
2870 CheckFeature terminal 2906 CheckFeature terminal
2871 call Popupwin_close_prevwin() 2907 call Popupwin_close_prevwin()