Lines Matching refs:buf
18 let buf = Run_shell_in_terminal({})
28 call StopShellInTerminal(buf)
29 call TermWait(buf)
38 call assert_equal("", bufname(buf))
45 let buf = Run_shell_in_terminal({})
46 call assert_match('^!', bufname(buf))
48 call assert_equal("", bufname(buf))
50 call StopShellInTerminal(buf)
51 call TermWait(buf)
56 let buf = Run_shell_in_terminal({})
58 call StopShellInTerminal(buf)
72 let buf = Run_shell_in_terminal({})
73 call StopShellInTerminal(buf)
74 call TermWait(buf)
78 call assert_fails(buf . 'bwipe', 'E89:')
81 exe buf . 'bwipe'
88 let buf = Run_shell_in_terminal({})
90 call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))})
96 exe buf . 'bwipe!'
101 let buf = Run_shell_in_terminal({})
102 call assert_fails(buf . 'bwipe', 'E89:')
103 exe buf . 'bwipe!'
105 call assert_equal("", bufname(buf))
111 let buf = Run_shell_in_terminal({})
112 call TermWait(buf)
115 call TermWait(buf)
122 exe buf . 'bwipe'
127 let buf = Run_shell_in_terminal({})
131 call assert_notequal(winbufnr(nr), buf)
133 call assert_true(bufloaded(buf))
134 call assert_true(buflisted(buf))
136 exe 'split ' . buf . 'buf'
137 call StopShellInTerminal(buf)
138 exe buf . 'bwipe'
145 let buf = bufnr()
147 call WaitForAssert({-> assert_equal('finished', term_getstatus(buf))})
148 call assert_true(bufloaded(buf))
149 call assert_true(buflisted(buf))
151 call assert_true(bufloaded(buf))
152 call assert_true(buflisted(buf))
153 exe buf .. 'buf'
154 call assert_equal(buf, bufnr())
157 call assert_false(bufloaded(buf))
158 call assert_false(buflisted(buf))
164 let buf = term_start(cmd, {'term_name': 'foo'})
165 call WaitForAssert({-> assert_equal('finished', term_getstatus(buf))})
171 exe 'bwipe! ' .. buf
175 exe g:buf . 'bwipe!'
176 let g:buf = 0
195 let g:buf = term_start(cmd, {'exit_cb': function('s:Nasty_exit_cb')})
196 let g:job = term_getjob(g:buf)
199 call WaitForAssert({-> assert_equal(0, g:buf)})
201 unlet g:buf
205 func Check_123(buf) argument
206 let l = term_scrape(a:buf, 0)
208 let l = term_scrape(a:buf, 999)
210 let l = a:buf->term_scrape(1)
230 let l = term_getline(a:buf, -1)
232 let l = term_getline(a:buf, 0)
234 let l = term_getline(a:buf, 999)
236 let l = term_getline(a:buf, 1)
242 let buf = term_start(cmd)
246 call assert_equal(buf, termlist[0])
251 call TermWait(buf)
254 call WaitForAssert({-> assert_equal(3, len(term_scrape(buf, 1)))})
255 call Check_123(buf)
258 let job = term_getjob(buf)
260 call TermWait(buf)
261 call Check_123(buf)
263 exe buf . 'bwipe'
272 let buf = term_start("cmd /K chcp 65001")
273 call term_sendkeys(buf, "type Xtext\<CR>")
274 eval buf->term_sendkeys("exit\<CR>")
277 let buf = term_start("cat Xtext")
281 call WaitFor({-> len(term_scrape(buf, line)) >= 7 && term_scrape(buf, line)[0].chars == "l"})
282 let l = term_scrape(buf, line)
294 let job = term_getjob(buf)
296 call TermWait(buf)
298 exe buf . 'bwipe'
307 let buf = bufnr('$')
308 call TermWait(buf, 100)
311 call term_sendkeys(buf, "キ")
312 call TermWait(buf, 10)
314 exe buf . 'bwipe!'
324 let buf = term_start(cmd)
326 let job = term_getjob(buf)
328 call TermWait(buf)
332 let scrolled = buf->term_getscrolled()
334 if scrolled == buf->term_getscrolled()
340 call assert_equal('1', term_getline(buf, 1 - scrolled))
342 call assert_equal('49', term_getline(buf, 49 - scrolled))
344 call assert_equal('200', term_getline(buf, 200 - scrolled))
346 exe buf . 'bwipe'
351 let buf = Run_shell_in_terminal({'term_rows': 15})
355 call term_sendkeys(buf, "type Xtext\<CR>")
357 call term_sendkeys(buf, "cat Xtext\<CR>")
359 let rows = term_getsize(buf)[0]
361 …call WaitForAssert({-> assert_match( '149', term_getline(buf, rows - 1) . term_getline(buf, rows -…
365 call StopShellInTerminal(buf)
366 call TermWait(buf)
367 exe buf . 'bwipe'
385 let buf = RunVimInTerminal('-S XTest_postponed', {})
387 call VerifyScreenDump(buf, 'Test_terminal_scrollback_1', {})
391 call term_sendkeys(buf, "k")
392 call VerifyScreenDump(buf, 'Test_terminal_scrollback_2', {})
395 call term_sendkeys(buf, "a")
396 call VerifyScreenDump(buf, 'Test_terminal_scrollback_3', {})
399 call term_sendkeys(buf, "\<C-C>")
400 call TermWait(buf, 25)
402 call term_sendkeys(buf, "exit\<CR>")
403 call TermWait(buf, 50)
405 let tsk_ret = term_sendkeys(buf, ":q\<CR>")
410 call StopVimInTerminal(buf)
566 let buf = bufnr('%')
569 call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))})
570 call StopShellInTerminal(buf)
575 let buf = bufnr('%')
578 call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))})
579 call StopShellInTerminal(buf)
637 let buf = term_start(cmd, {'cwd': 'Xdir'})
640 exe buf . 'bwipe'
679 let buf = Run_shell_in_terminal({})
681 call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))})
683 call term_sendkeys(buf, "echo %" . a:name . "%\r")
685 call term_sendkeys(buf, "echo $" . a:name . "\r")
687 call TermWait(buf)
688 call StopShellInTerminal(buf)
691 exe buf . 'bwipe'
692 unlet buf
696 let buf = Run_shell_in_terminal({'env': {'TESTENV': 'correct'}})
698 call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))})
700 call term_sendkeys(buf, "echo %TESTENV%\r")
702 call term_sendkeys(buf, "echo $TESTENV\r")
704 eval buf->TermWait()
705 call StopShellInTerminal(buf)
708 exe buf . 'bwipe'
712 let buf = term_start([&shell, &shellcmdflag, 'echo "123"'])
713 call assert_fails(buf . 'bwipe', 'E89:')
714 exe buf . 'bwipe!'
715 call assert_equal("", bufname(buf))
720 let buf = term_start(&shell)
738 call term_sendkeys(buf, 'echo ' . repeat(c, len) . "\<cr>")
740 call term_sendkeys(buf, "echo done\<cr>")
744 let lnum = term_getsize(buf)[0] - 1
745 …ll WaitForAssert({-> assert_match('done', term_getline(buf, lnum - 1) .. '//' .. term_getline(buf,…
746 let line = term_getline(buf, lnum)
748 let line = term_getline(buf, lnum - 1)
752 let g:job = term_getjob(buf)
753 call StopShellInTerminal(buf)
754 call TermWait(buf)
828 let buf = term_start('NONE', {})
829 call assert_notequal(0, buf)
831 let pty = job_info(term_getjob(buf))['tty_out']
840 call WaitForAssert({-> assert_match('look here', term_getline(buf, 1))})
880 let buf = term_start(cmd, {'out_io': 'file', 'out_name': 'Xfile'})
881 call TermWait(buf)
887 let g:job = term_getjob(buf)
901 let buf = term_start('cat', {'in_io': 'file', 'in_name': 'Xfile'})
902 call TermWait(buf)
903 call WaitForAssert({-> assert_equal('one line', term_getline(buf, 1))})
904 let g:job = term_getjob(buf)
912 let buf = Run_shell_in_terminal({})
914 call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))})
927 call WaitForAssert({-> assert_match('abxde\|456', term_getline(buf, term_getcursor(buf)[0]))})
928 let lnum = term_getcursor(buf)[0]
930 call assert_match('abxde', term_getline(buf, lnum))
932 call assert_match('456', term_getline(buf, lnum))
935 call term_sendkeys(buf, "\r")
936 call StopShellInTerminal(buf)
937 call TermWait(buf)
952 let buf = Run_shell_in_terminal({})
954 call StopShellInTerminal(buf)
955 call TermWait(buf)
956 exe buf . 'bwipe'
961 let buf = Run_shell_in_terminal({})
963 call StopShellInTerminal(buf)
964 call TermWait(buf)
965 exe buf . 'bwipe'
983 let buf = term_start(cmd, {'curwin': 1})
984 let g:job = term_getjob(buf)
985 call WaitFor({-> term_getline(buf, 1) !=# ''}, 1000)
995 call term_sendkeys(buf, "echo " . txt)
996 call TermWait(buf, 25)
997 call assert_match("echo " . txt, term_getline(buf, lnum[0]))
998 call term_sendkeys(buf, "\<cr>")
999 call WaitForAssert({-> assert_equal(txt, term_getline(buf, lnum[0] + 1))}, 1000)
1000 let l = term_scrape(buf, lnum[0] + 1)
1007 call term_sendkeys(buf, "echo " . txt)
1008 call TermWait(buf, 25)
1009 call assert_match("echo " . txt, term_getline(buf, lnum[1]))
1010 call term_sendkeys(buf, "\<cr>")
1011 call WaitForAssert({-> assert_equal(txt, term_getline(buf, lnum[1] + 1))}, 1000)
1012 let l = term_scrape(buf, lnum[1] + 1)
1026 call term_sendkeys(buf, "echo " . txt)
1027 call TermWait(buf, 25)
1028 call assert_match("echo " . txt, term_getline(buf, lnum[2]))
1029 call term_sendkeys(buf, "\<cr>")
1030 call WaitForAssert({-> assert_equal(txt, term_getline(buf, lnum[2] + 1))}, 1000)
1031 let l = term_scrape(buf, lnum[2] + 1)
1034 call term_sendkeys(buf, "exit\r")
1107 let buf = Run_shell_in_terminal({})
1108 call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))})
1110 call term_sendkeys(buf, "cat\<CR>")
1111 call WaitForAssert({-> assert_match('cat', term_getline(buf, 1))})
1114 call term_sendkeys(buf, "\x1b[6n\<CR>")
1117 call WaitForAssert({-> assert_match('3;1R', term_getline(buf, 4))})
1120 call term_sendkeys(buf, "\<CR>\<C-D>")
1122 call StopShellInTerminal(buf)
1123 exe buf . 'bwipe'
1135 \ 'let buf = bufnr("%")',
1136 \ 'while term_getline(buf, 1) =~ "^\\s*$"',
1159 call Run_terminal_qall_kill('term', 'eval buf->term_setkill("kill")')
1167 let buf = bufnr("%")
1168 while term_getline(buf, 1) =~ "^\\s*$"
1174 au! VimLeavePre * exe buf . "bwipe!" | call writefile(["done"], "Xdone")
1189 let buf = RunVimInTerminal('', {})
1192 call term_sendkeys(buf, ":term\<CR>")
1193 call WaitForAssert({-> assert_match('\[running]', term_getline(buf, 10))})
1194 call WaitForAssert({-> assert_notmatch('^\s*$', term_getline(buf, 1))})
1197 call term_sendkeys(buf, "\<C-W>:confirm qall\<CR>")
1198 call WaitForAssert({-> assert_match('ancel:', term_getline(buf, 20))})
1199 call term_sendkeys(buf, "y")
1200 call WaitForAssert({-> assert_equal('finished', term_getstatus(buf))})
1221 let buf = RunVimInTerminal('-S XtermExit', #{rows: 10})
1222 let job = term_getjob(buf)
1226 call term_sendkeys(buf, "exit\<CR>")
1253 for buf in term_list()
1254 exe buf . "bwipe!"
1258 let buf = term_start(&shell, {'hidden': 1})
1260 exe buf . "bwipe!"
1277 let buf = RunVimInTerminal('-S Xopenterm', {})
1280 call term_sendkeys(buf, "/\<F3>")
1281 call VerifyScreenDump(buf, 'Test_terminal_from_cmd', {})
1282 call term_sendkeys(buf, "\<Esc>")
1283 call term_sendkeys(buf, ":q\<CR>")
1285 call StopVimInTerminal(buf)
1298 let buf = RunVimInTerminal('-S Xcombining', #{rows: 9})
1301 call VerifyScreenDump(buf, 'Test_terminal_combining', {})
1302 call term_sendkeys(buf, ":q\<CR>")
1304 call StopVimInTerminal(buf)
1311 let buf = term_start(&shell, #{hidden: v:true})
1312 let s:winid = popup_create(buf, {})
1317 exe 'bwipe! ' .. buf
1369 let buf = RunVimInTerminal('--cmd "set encoding=utf-8" Xcomposing', {})
1370 call WaitForAssert({-> assert_match(text, term_getline(buf, 1))})
1371 eval 'Xdump'->term_dumpwrite(buf)
1375 call StopVimInTerminal(buf)
1385 let buf = RunVimInTerminal('', {})
1386 call TermWait(buf)
1387 call assert_fails("call term_dumpwrite(buf, 'Xtest.dump', '')", 'E715:')
1388 call assert_fails("call term_dumpwrite(buf, [])", 'E730:')
1390 call assert_fails("call term_dumpwrite(buf, 'Xtest.dump')", 'E953:')
1392 call assert_fails("call term_dumpwrite(buf, '')", 'E482:')
1393 call assert_fails("call term_dumpwrite(buf, test_null_string())", 'E482:')
1395 call StopVimInTerminal(buf, 0)
1396 call TermWait(buf)
1397 call assert_fails("call term_dumpwrite(buf, 'Xtest.dump')", 'E958:')
1399 call assert_equal(0, term_sendkeys(buf, ":q\<CR>"))
1406 let buf = term_dumpload('dumps/Test_popup_command_01.dump')
1412 let buf2 = 'dumps/Test_diff_01.dump'->term_dumpload({'bufnr': buf})
1413 call assert_equal(buf, buf2)
1417 let buf2 = term_dumpload('dumps/Test_popup_command_01.dump', {'bufnr': buf})
1418 call assert_equal(buf, buf2)
1440 let buf = RunVimInTerminal('-S XtermDumpload', #{rows: 15})
1441 call VerifyScreenDump(buf, 'Test_terminal_dumpload', {})
1443 call StopVimInTerminal(buf)
1572 let buf = RunVimInTerminal('-S Xscript', {})
1576 return buf
1581 let buf = Api_drop_common('')
1585 call StopVimInTerminal(buf)
1592 let buf = Api_drop_common(',{"bin":1}')
1595 call StopVimInTerminal(buf)
1602 let buf = Api_drop_common(',{"binary":1}')
1605 call StopVimInTerminal(buf)
1613 let buf = Api_drop_common(',{"nobin":1}')
1616 call StopVimInTerminal(buf)
1625 let buf = Api_drop_common(',{"nobinary":1}')
1628 call StopVimInTerminal(buf)
1636 let buf = Api_drop_common(',{"ff":"dos"}')
1639 call StopVimInTerminal(buf)
1646 let buf = Api_drop_common(',{"fileformat":"dos"}')
1649 call StopVimInTerminal(buf)
1656 let buf = Api_drop_common(',{"enc":"utf-16"}')
1659 call StopVimInTerminal(buf)
1666 let buf = Api_drop_common(',{"encoding":"utf-16"}')
1669 call StopVimInTerminal(buf)
1690 let buf = RunVimInTerminal('-S Xscript', {'rows': 10})
1694 call StopVimInTerminal(buf)
1724 let buf = RunVimInTerminal('-S Xscript', {})
1726 call assert_equal(buf, g:called_bufnum)
1728 call StopVimInTerminal(buf)
1734 let buf = RunVimInTerminal('-S Xscript', {'term_api': 'Tapi_Try'})
1736 call assert_equal(buf, g:called_bufnum)
1738 call StopVimInTerminal(buf)
1751 let buf = RunVimInTerminal('-S Xscript', {'term_api': 'ApiCall_'})
1753 call assert_equal(buf, g:called_bufnum2)
1755 call StopVimInTerminal(buf)
1783 let buf = RunVimInTerminal('-S Xscript', {'term_api': ''})
1787 call StopVimInTerminal(buf)
1791 let buf = RunVimInTerminal('-S Xscript', {'term_api': 'TryThat'})
1795 call StopVimInTerminal(buf)
1819 let buf = RunVimInTerminal('-S Xscript', {})
1822 call StopVimInTerminal(buf)
1836 let buf = RunVimInTerminal('-S Xscript', {'term_api': ''})
1841 eval buf->term_setapi('Tapi_')
1842 call term_sendkeys(buf, ":set notitle\<CR>")
1843 call term_sendkeys(buf, ":source Xscript\<CR>")
1845 call assert_equal(buf, g:called_bufnum)
1848 call StopVimInTerminal(buf)
1867 let buf = bufnr('%')
1872 call StopVimInTerminal(buf)
1877 let buf = bufnr('%')
1879 call assert_equal(buf, g:called_bufnum)
1882 call StopVimInTerminal(buf)
1905 let buf = Run_shell_in_terminal({})
1906 call assert_equal(colors, term_getansicolors(buf))
1907 call StopShellInTerminal(buf)
1908 call TermWait(buf)
1909 call assert_equal([], term_getansicolors(buf))
1911 exe buf . 'bwipe'
1930 let buf = Run_shell_in_terminal({})
1931 call assert_equal(g:terminal_ansi_colors, term_getansicolors(buf))
1932 call StopShellInTerminal(buf)
1933 call TermWait(buf)
1935 exe buf . 'bwipe'
1944 let buf = Run_shell_in_terminal({'ansi_colors': s:test_colors})
1945 call assert_equal(s:test_colors, term_getansicolors(buf))
1947 call term_setansicolors(buf, g:terminal_ansi_colors)
1948 call assert_equal(g:terminal_ansi_colors, buf->term_getansicolors())
1960 eval buf->term_setansicolors(colors)
1963 call assert_fails('call term_setansicolors(buf, colors)', 'E254:')
1964 call assert_fails('call term_setansicolors(buf, {})', 'E714:')
1966 call StopShellInTerminal(buf)
1967 call TermWait(buf)
1968 call assert_equal(0, term_setansicolors(buf, []))
1969 exe buf . 'bwipe'
2019 let buf = RunVimInTerminal('-S Xcolorscript', {'rows': 10})
2020 call VerifyScreenDump(buf, 'Test_terminal_all_ansi_colors', {})
2022 call term_sendkeys(buf, ":q\<CR>")
2023 call StopVimInTerminal(buf)
2043 let buf = term_start(cmd, #{term_finish: 'close', hidden: 1})
2046 let job = term_getjob(buf)