Mercurial > vim
annotate src/testdir/test_terminal3.vim @ 21960:402f745d2d2b
Added tag v8.2.1529 for changeset 67d4be2757b007a6433d5d8ff410c1f1e5a44444
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 27 Aug 2020 23:15:05 +0200 |
parents | e0af4660dfc7 |
children | b85e13213b11 |
rev | line source |
---|---|
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 " Tests for the terminal window. |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 " This is split in two, because it can take a lot of time. |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 " See test_terminal.vim and test_terminal2.vim for further tests. |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 source check.vim |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 CheckFeature terminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 source shared.vim |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 source screendump.vim |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 source mouse.vim |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 source term_util.vim |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 let $PROMPT_COMMAND='' |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 func Test_terminal_altscreen() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
16 " somehow doesn't work on MS-Windows |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 CheckUnix |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
18 let cmd = "cat Xtext\<CR>" |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
19 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
20 let buf = term_start(&shell, {}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 call writefile(["\<Esc>[?1047h"], 'Xtext') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 call term_sendkeys(buf, cmd) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 call WaitForAssert({-> assert_equal(1, term_getaltscreen(buf))}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
25 call writefile(["\<Esc>[?1047l"], 'Xtext') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
26 call term_sendkeys(buf, cmd) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
27 call WaitForAssert({-> assert_equal(0, term_getaltscreen(buf))}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
28 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 call term_sendkeys(buf, "exit\r") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
30 exe buf . "bwipe!" |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
31 call delete('Xtext') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
32 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
33 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
34 func Test_terminal_shell_option() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
35 if has('unix') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
36 " exec is a shell builtin command, should fail without a shell. |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
37 term exec ls runtest.vim |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
38 call WaitForAssert({-> assert_match('job failed', term_getline(bufnr(), 1))}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
39 bwipe! |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
40 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
41 term ++shell exec ls runtest.vim |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
42 call WaitForAssert({-> assert_match('runtest.vim', term_getline(bufnr(), 1))}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
43 bwipe! |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
44 elseif has('win32') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
45 " dir is a shell builtin command, should fail without a shell. |
21524
8c6433359913
patch 8.2.1312: MS-Windows: terminal test may fail if dir.exe exists
Bram Moolenaar <Bram@vim.org>
parents:
21427
diff
changeset
|
46 " However, if dir.exe (which might be provided by Cygwin/MSYS2) exists in |
8c6433359913
patch 8.2.1312: MS-Windows: terminal test may fail if dir.exe exists
Bram Moolenaar <Bram@vim.org>
parents:
21427
diff
changeset
|
47 " the %PATH%, "term dir" succeeds unintentionally. Use dir.com instead. |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
48 try |
21524
8c6433359913
patch 8.2.1312: MS-Windows: terminal test may fail if dir.exe exists
Bram Moolenaar <Bram@vim.org>
parents:
21427
diff
changeset
|
49 term dir.com /b runtest.vim |
8c6433359913
patch 8.2.1312: MS-Windows: terminal test may fail if dir.exe exists
Bram Moolenaar <Bram@vim.org>
parents:
21427
diff
changeset
|
50 call WaitForAssert({-> assert_match('job failed', term_getline(bufnr(), 1))}) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
51 catch /CreateProcess/ |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
52 " ignore |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
53 endtry |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
54 bwipe! |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
55 |
21524
8c6433359913
patch 8.2.1312: MS-Windows: terminal test may fail if dir.exe exists
Bram Moolenaar <Bram@vim.org>
parents:
21427
diff
changeset
|
56 " This should execute the dir builtin command even with ".com". |
8c6433359913
patch 8.2.1312: MS-Windows: terminal test may fail if dir.exe exists
Bram Moolenaar <Bram@vim.org>
parents:
21427
diff
changeset
|
57 term ++shell dir.com /b runtest.vim |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
58 call WaitForAssert({-> assert_match('runtest.vim', term_getline(bufnr(), 1))}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
59 bwipe! |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21524
diff
changeset
|
60 else |
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21524
diff
changeset
|
61 throw 'Skipped: does not work on this platform' |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
62 endif |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
63 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
64 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
65 func Test_terminal_invalid_arg() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
66 call assert_fails('terminal ++xyz', 'E181:') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
67 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
68 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
69 func Test_terminal_in_popup() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
70 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
71 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
72 let text =<< trim END |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
73 some text |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
74 to edit |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
75 in a popup window |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
76 END |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
77 call writefile(text, 'Xtext') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
78 let cmd = GetVimCommandCleanTerm() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
79 let lines = [ |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
80 \ 'call setline(1, range(20))', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
81 \ 'hi PopTerm ctermbg=grey', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
82 \ 'func OpenTerm(setColor)', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
83 \ " set noruler", |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
84 \ " let s:buf = term_start('" .. cmd .. " Xtext', #{hidden: 1, term_finish: 'close'})", |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
85 \ ' let g:winid = popup_create(s:buf, #{minwidth: 45, minheight: 7, border: [], drag: 1, resize: 1})', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
86 \ ' if a:setColor', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
87 \ ' call win_execute(g:winid, "set wincolor=PopTerm")', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
88 \ ' endif', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
89 \ 'endfunc', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
90 \ 'func HidePopup()', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
91 \ ' call popup_hide(g:winid)', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
92 \ 'endfunc', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
93 \ 'func ClosePopup()', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
94 \ ' call popup_close(g:winid)', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
95 \ 'endfunc', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
96 \ 'func ReopenPopup()', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
97 \ ' call popup_create(s:buf, #{minwidth: 40, minheight: 6, border: []})', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
98 \ 'endfunc', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
99 \ ] |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
100 call writefile(lines, 'XtermPopup') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
101 let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
102 call TermWait(buf, 100) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
103 call term_sendkeys(buf, ":call OpenTerm(0)\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
104 call TermWait(buf, 100) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
105 call term_sendkeys(buf, ":\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
106 call TermWait(buf, 100) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
107 call term_sendkeys(buf, "\<C-W>:echo getwinvar(g:winid, \"&buftype\") win_gettype(g:winid)\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
108 call VerifyScreenDump(buf, 'Test_terminal_popup_1', {}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
109 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
110 call term_sendkeys(buf, ":q\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
111 call VerifyScreenDump(buf, 'Test_terminal_popup_2', {}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
112 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
113 call term_sendkeys(buf, ":call OpenTerm(1)\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
114 call TermWait(buf, 150) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
115 call term_sendkeys(buf, ":set hlsearch\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
116 call TermWait(buf, 100) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
117 call term_sendkeys(buf, "/edit\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
118 call VerifyScreenDump(buf, 'Test_terminal_popup_3', {}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
119 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
120 call term_sendkeys(buf, "\<C-W>:call HidePopup()\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
121 call VerifyScreenDump(buf, 'Test_terminal_popup_4', {}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
122 call term_sendkeys(buf, "\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
123 call TermWait(buf, 50) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
124 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
125 call term_sendkeys(buf, "\<C-W>:call ClosePopup()\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
126 call VerifyScreenDump(buf, 'Test_terminal_popup_5', {}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
127 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
128 call term_sendkeys(buf, "\<C-W>:call ReopenPopup()\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
129 call VerifyScreenDump(buf, 'Test_terminal_popup_6', {}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
130 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
131 " Go to terminal-Normal mode and visually select text. |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
132 call term_sendkeys(buf, "\<C-W>Ngg/in\<CR>vww") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
133 call VerifyScreenDump(buf, 'Test_terminal_popup_7', {}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
134 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
135 " Back to job mode, redraws |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
136 call term_sendkeys(buf, "A") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
137 call VerifyScreenDump(buf, 'Test_terminal_popup_8', {}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
138 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
139 call TermWait(buf, 50) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
140 call term_sendkeys(buf, ":q\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
141 call TermWait(buf, 150) " wait for terminal to vanish |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
142 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
143 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
144 call delete('Xtext') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
145 call delete('XtermPopup') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
146 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
147 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
148 " Check a terminal in popup window uses the default mininum size. |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
149 func Test_terminal_in_popup_min_size() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
150 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
151 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
152 let text =<< trim END |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
153 another text |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
154 to show |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
155 in a popup window |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
156 END |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
157 call writefile(text, 'Xtext') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
158 let lines = [ |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
159 \ 'call setline(1, range(20))', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
160 \ 'func OpenTerm()', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
161 \ " let s:buf = term_start('cat Xtext', #{hidden: 1})", |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
162 \ ' let g:winid = popup_create(s:buf, #{ border: []})', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
163 \ 'endfunc', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
164 \ ] |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
165 call writefile(lines, 'XtermPopup') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
166 let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
167 call TermWait(buf, 100) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
168 call term_sendkeys(buf, ":set noruler\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
169 call term_sendkeys(buf, ":call OpenTerm()\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
170 call TermWait(buf, 50) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
171 call term_sendkeys(buf, ":\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
172 call VerifyScreenDump(buf, 'Test_terminal_popup_m1', {}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
173 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
174 call TermWait(buf, 50) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
175 call term_sendkeys(buf, ":q\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
176 call TermWait(buf, 50) " wait for terminal to vanish |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
177 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
178 call delete('Xtext') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
179 call delete('XtermPopup') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
180 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
181 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
182 " Check a terminal in popup window with different colors |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
183 func Terminal_in_popup_colored(group_name, highlight_cmd, highlight_opt) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
184 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
185 CheckUnix |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
186 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
187 let lines = [ |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
188 \ 'call setline(1, range(20))', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
189 \ 'func OpenTerm()', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
190 \ " let s:buf = term_start('cat', #{hidden: 1, " |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
191 \ .. a:highlight_opt .. "})", |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
192 \ ' let g:winid = popup_create(s:buf, #{ border: []})', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
193 \ 'endfunc', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
194 \ a:highlight_cmd, |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
195 \ ] |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
196 call writefile(lines, 'XtermPopup') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
197 let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
198 call TermWait(buf, 100) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
199 call term_sendkeys(buf, ":set noruler\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
200 call term_sendkeys(buf, ":call OpenTerm()\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
201 call TermWait(buf, 50) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
202 call term_sendkeys(buf, "hello\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
203 call VerifyScreenDump(buf, 'Test_terminal_popup_' .. a:group_name, {}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
204 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
205 call term_sendkeys(buf, "\<C-D>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
206 call TermWait(buf, 50) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
207 call term_sendkeys(buf, ":q\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
208 call TermWait(buf, 50) " wait for terminal to vanish |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
209 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
210 call delete('XtermPopup') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
211 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
212 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
213 func Test_terminal_in_popup_colored_Terminal() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
214 call Terminal_in_popup_colored("Terminal", "highlight Terminal ctermfg=blue ctermbg=yellow", "") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
215 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
216 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
217 func Test_terminal_in_popup_colored_group() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
218 call Terminal_in_popup_colored("MyTermCol", "highlight MyTermCol ctermfg=darkgreen ctermbg=lightblue", "term_highlight: 'MyTermCol',") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
219 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
220 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
221 func Test_double_popup_terminal() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
222 let buf1 = term_start(&shell, #{hidden: 1}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
223 let win1 = popup_create(buf1, {}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
224 let buf2 = term_start(&shell, #{hidden: 1}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
225 call assert_fails('call popup_create(buf2, {})', 'E861:') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
226 call popup_close(win1) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
227 exe buf1 .. 'bwipe!' |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
228 exe buf2 .. 'bwipe!' |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
229 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
230 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
231 func Test_issue_5607() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
232 let wincount = winnr('$') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
233 exe 'terminal' &shell &shellcmdflag 'exit' |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
234 let job = term_getjob(bufnr()) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
235 call WaitForAssert({-> assert_equal("dead", job_status(job))}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
236 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
237 let old_wincolor = &wincolor |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
238 try |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
239 set wincolor= |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
240 finally |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
241 let &wincolor = old_wincolor |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
242 bw! |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
243 endtry |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
244 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
245 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
246 func Test_hidden_terminal() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
247 let buf = term_start(&shell, #{hidden: 1}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
248 call assert_equal('', bufname('^$')) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
249 call StopShellInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
250 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
251 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
252 func Test_term_nasty_callback() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
253 CheckExecutable sh |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
254 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
255 set hidden |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
256 let g:buf0 = term_start('sh', #{hidden: 1, term_finish: 'close'}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
257 call popup_create(g:buf0, {}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
258 call assert_fails("call term_start(['sh', '-c'], #{curwin: 1})", 'E863:') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
259 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
260 call popup_clear(1) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
261 set hidden& |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
262 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
263 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
264 func Test_term_and_startinsert() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
265 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
266 CheckUnix |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
267 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
268 let lines =<< trim EOL |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
269 put='some text' |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
270 term |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
271 startinsert |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
272 EOL |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
273 call writefile(lines, 'XTest_startinsert') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
274 let buf = RunVimInTerminal('-S XTest_startinsert', {}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
275 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
276 call term_sendkeys(buf, "exit\r") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
277 call WaitForAssert({-> assert_equal("some text", term_getline(buf, 1))}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
278 call term_sendkeys(buf, "0l") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
279 call term_sendkeys(buf, "A<\<Esc>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
280 call WaitForAssert({-> assert_equal("some text<", term_getline(buf, 1))}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
281 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
282 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
283 call delete('XTest_startinsert') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
284 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
285 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
286 " Test for passing invalid arguments to terminal functions |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
287 func Test_term_func_invalid_arg() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
288 call assert_fails('let b = term_getaltscreen([])', 'E745:') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
289 call assert_fails('let a = term_getattr(1, [])', 'E730:') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
290 call assert_fails('let c = term_getcursor([])', 'E745:') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
291 call assert_fails('let l = term_getline([], 1)', 'E745:') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
292 call assert_fails('let l = term_getscrolled([])', 'E745:') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
293 call assert_fails('let s = term_getsize([])', 'E745:') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
294 call assert_fails('let s = term_getstatus([])', 'E745:') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
295 call assert_fails('let s = term_scrape([], 1)', 'E745:') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
296 call assert_fails('call term_sendkeys([], "a")', 'E745:') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
297 call assert_fails('call term_setapi([], "")', 'E745:') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
298 call assert_fails('call term_setrestore([], "")', 'E745:') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
299 call assert_fails('call term_setkill([], "")', 'E745:') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
300 if has('gui') || has('termguicolors') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
301 call assert_fails('let p = term_getansicolors([])', 'E745:') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
302 call assert_fails('call term_setansicolors([], [])', 'E745:') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
303 endif |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
304 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
305 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
306 " Test for sending various special keycodes to a terminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
307 func Test_term_keycode_translation() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
308 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
309 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
310 let buf = RunVimInTerminal('', {}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
311 call term_sendkeys(buf, ":set nocompatible\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
312 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
313 let keys = ["\<F1>", "\<F2>", "\<F3>", "\<F4>", "\<F5>", "\<F6>", "\<F7>", |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
314 \ "\<F8>", "\<F9>", "\<F10>", "\<F11>", "\<F12>", "\<Home>", |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
315 \ "\<S-Home>", "\<C-Home>", "\<End>", "\<S-End>", "\<C-End>", |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
316 \ "\<Ins>", "\<Del>", "\<Left>", "\<S-Left>", "\<C-Left>", "\<Right>", |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
317 \ "\<S-Right>", "\<C-Right>", "\<Up>", "\<S-Up>", "\<Down>", |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
318 \ "\<S-Down>"] |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
319 let output = ['<F1>', '<F2>', '<F3>', '<F4>', '<F5>', '<F6>', '<F7>', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
320 \ '<F8>', '<F9>', '<F10>', '<F11>', '<F12>', '<Home>', '<S-Home>', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
321 \ '<C-Home>', '<End>', '<S-End>', '<C-End>', '<Insert>', '<Del>', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
322 \ '<Left>', '<S-Left>', '<C-Left>', '<Right>', '<S-Right>', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
323 \ '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>'] |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
324 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
325 call term_sendkeys(buf, "i") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
326 for i in range(len(keys)) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
327 call term_sendkeys(buf, "\<C-U>\<C-K>" .. keys[i]) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
328 call WaitForAssert({-> assert_equal(output[i], term_getline(buf, 1))}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
329 endfor |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
330 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
331 let keypad_keys = ["\<k0>", "\<k1>", "\<k2>", "\<k3>", "\<k4>", "\<k5>", |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
332 \ "\<k6>", "\<k7>", "\<k8>", "\<k9>", "\<kPoint>", "\<kPlus>", |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
333 \ "\<kMinus>", "\<kMultiply>", "\<kDivide>"] |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
334 let keypad_output = ['0', '1', '2', '3', '4', '5', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
335 \ '6', '7', '8', '9', '.', '+', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
336 \ '-', '*', '/'] |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
337 for i in range(len(keypad_keys)) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
338 " TODO: Mysteriously keypad 3 and 9 do not work on some systems. |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
339 if keypad_output[i] == '3' || keypad_output[i] == '9' |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
340 continue |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
341 endif |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
342 call term_sendkeys(buf, "\<C-U>" .. keypad_keys[i]) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
343 call WaitForAssert({-> assert_equal(keypad_output[i], term_getline(buf, 1))}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
344 endfor |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
345 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
346 call feedkeys("\<C-U>\<kEnter>\<BS>one\<C-W>.two", 'xt') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
347 call WaitForAssert({-> assert_equal('two', term_getline(buf, 1))}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
348 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
349 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
350 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
351 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
352 " Test for using the mouse in a terminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
353 func Test_term_mouse() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
354 CheckNotGui |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
355 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
356 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
357 let save_mouse = &mouse |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
358 let save_term = &term |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
359 let save_ttymouse = &ttymouse |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
360 let save_clipboard = &clipboard |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
361 set mouse=a term=xterm ttymouse=sgr mousetime=200 clipboard= |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
362 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
363 let lines =<< trim END |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
364 one two three four five |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
365 red green yellow red blue |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
366 vim emacs sublime nano |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
367 END |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
368 call writefile(lines, 'Xtest_mouse') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
369 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
370 " Create a terminal window running Vim for the test with mouse enabled |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
371 let prev_win = win_getid() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
372 let buf = RunVimInTerminal('Xtest_mouse -n', {}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
373 call term_sendkeys(buf, ":set nocompatible\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
374 call term_sendkeys(buf, ":set mouse=a term=xterm ttymouse=sgr\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
375 call term_sendkeys(buf, ":set clipboard=\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
376 call term_sendkeys(buf, ":set mousemodel=extend\<CR>") |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
377 call TermWait(buf) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
378 redraw! |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
379 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
380 " Use the mouse to enter the terminal window |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
381 call win_gotoid(prev_win) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
382 call feedkeys(MouseLeftClickCode(1, 1), 'x') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
383 call feedkeys(MouseLeftReleaseCode(1, 1), 'x') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
384 call assert_equal(1, getwininfo(win_getid())[0].terminal) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
385 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
386 " Test for <LeftMouse> click/release |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
387 call test_setmouse(2, 5) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
388 call feedkeys("\<LeftMouse>\<LeftRelease>", 'xt') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
389 call test_setmouse(3, 8) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
390 call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>") |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
391 call TermWait(buf, 50) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
392 call term_sendkeys(buf, ":call writefile([json_encode(getpos('.'))], 'Xbuf')\<CR>") |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
393 call TermWait(buf, 50) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
394 let pos = json_decode(readfile('Xbuf')[0]) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
395 call assert_equal([3, 8], pos[1:2]) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
396 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
397 " Test for selecting text using mouse |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
398 call delete('Xbuf') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
399 call test_setmouse(2, 11) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
400 call term_sendkeys(buf, "\<LeftMouse>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
401 call test_setmouse(2, 16) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
402 call term_sendkeys(buf, "\<LeftRelease>y") |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
403 call TermWait(buf, 50) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
404 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>") |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
405 call TermWait(buf, 50) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
406 call assert_equal('yellow', readfile('Xbuf')[0]) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
407 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
408 " Test for selecting text using doubleclick |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
409 call delete('Xbuf') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
410 call test_setmouse(1, 11) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
411 call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>\<LeftMouse>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
412 call test_setmouse(1, 17) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
413 call term_sendkeys(buf, "\<LeftRelease>y") |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
414 call TermWait(buf, 50) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
415 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>") |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
416 call TermWait(buf, 50) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
417 call assert_equal('three four', readfile('Xbuf')[0]) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
418 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
419 " Test for selecting a line using triple click |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
420 call delete('Xbuf') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
421 call test_setmouse(3, 2) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
422 call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>\<LeftMouse>\<LeftRelease>\<LeftMouse>\<LeftRelease>y") |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
423 call TermWait(buf, 50) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
424 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>") |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
425 call TermWait(buf, 50) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
426 call assert_equal("vim emacs sublime nano\n", readfile('Xbuf')[0]) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
427 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
428 " Test for selecting a block using qudraple click |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
429 call delete('Xbuf') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
430 call test_setmouse(1, 11) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
431 call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>\<LeftMouse>\<LeftRelease>\<LeftMouse>\<LeftRelease>\<LeftMouse>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
432 call test_setmouse(3, 13) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
433 call term_sendkeys(buf, "\<LeftRelease>y") |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
434 call TermWait(buf, 50) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
435 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>") |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
436 call TermWait(buf, 50) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
437 call assert_equal("ree\nyel\nsub", readfile('Xbuf')[0]) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
438 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
439 " Test for extending a selection using right click |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
440 call delete('Xbuf') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
441 call test_setmouse(2, 9) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
442 call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
443 call test_setmouse(2, 16) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
444 call term_sendkeys(buf, "\<RightMouse>\<RightRelease>y") |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
445 call TermWait(buf, 50) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
446 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>") |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
447 call TermWait(buf, 50) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
448 call assert_equal("n yellow", readfile('Xbuf')[0]) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
449 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
450 " Test for pasting text using middle click |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
451 call delete('Xbuf') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
452 call term_sendkeys(buf, ":let @r='bright '\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
453 call test_setmouse(2, 22) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
454 call term_sendkeys(buf, "\"r\<MiddleMouse>\<MiddleRelease>") |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
455 call TermWait(buf, 50) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
456 call term_sendkeys(buf, ":call writefile([getline(2)], 'Xbuf')\<CR>") |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
457 call TermWait(buf, 50) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
458 call assert_equal("red bright blue", readfile('Xbuf')[0][-15:]) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
459 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
460 " cleanup |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
461 call TermWait(buf) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
462 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
463 let &mouse = save_mouse |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
464 let &term = save_term |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
465 let &ttymouse = save_ttymouse |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
466 let &clipboard = save_clipboard |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
467 set mousetime& |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
468 call delete('Xtest_mouse') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
469 call delete('Xbuf') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
470 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
471 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
472 " Test for modeless selection in a terminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
473 func Test_term_modeless_selection() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
474 CheckUnix |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
475 CheckNotGui |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
476 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
477 CheckFeature clipboard_working |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
478 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
479 let save_mouse = &mouse |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
480 let save_term = &term |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
481 let save_ttymouse = &ttymouse |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
482 set mouse=a term=xterm ttymouse=sgr mousetime=200 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
483 set clipboard=autoselectml |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
484 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
485 let lines =<< trim END |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
486 one two three four five |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
487 red green yellow red blue |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
488 vim emacs sublime nano |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
489 END |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
490 call writefile(lines, 'Xtest_modeless') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
491 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
492 " Create a terminal window running Vim for the test with mouse disabled |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
493 let prev_win = win_getid() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
494 let buf = RunVimInTerminal('Xtest_modeless -n', {}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
495 call term_sendkeys(buf, ":set nocompatible\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
496 call term_sendkeys(buf, ":set mouse=\<CR>") |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
497 call TermWait(buf) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
498 redraw! |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
499 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
500 " Use the mouse to enter the terminal window |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
501 call win_gotoid(prev_win) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
502 call feedkeys(MouseLeftClickCode(1, 1), 'x') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
503 call feedkeys(MouseLeftReleaseCode(1, 1), 'x') |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
504 call TermWait(buf) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
505 call assert_equal(1, getwininfo(win_getid())[0].terminal) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
506 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
507 " Test for copying a modeless selection to clipboard |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
508 let @* = 'clean' |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
509 " communicating with X server may take a little time |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
510 sleep 100m |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
511 call feedkeys(MouseLeftClickCode(2, 3), 'x') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
512 call feedkeys(MouseLeftDragCode(2, 11), 'x') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
513 call feedkeys(MouseLeftReleaseCode(2, 11), 'x') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
514 call assert_equal("d green y", @*) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
515 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
516 " cleanup |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
517 call TermWait(buf) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
518 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
519 let &mouse = save_mouse |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
520 let &term = save_term |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
521 let &ttymouse = save_ttymouse |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
522 set mousetime& clipboard& |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
523 call delete('Xtest_modeless') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
524 new | only! |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
525 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
526 |
21295
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
527 func Test_terminal_getwinpos() |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
528 CheckRunVimInTerminal |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
529 |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
530 " split, go to the bottom-right window |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
531 split |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
532 wincmd j |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
533 set splitright |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
534 |
21427
299cf1c2a37d
patch 8.2.1264: terminal getwinpos() test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
21295
diff
changeset
|
535 let buf = RunVimInTerminal('', {'cols': 60}) |
299cf1c2a37d
patch 8.2.1264: terminal getwinpos() test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
21295
diff
changeset
|
536 call TermWait(buf, 100) |
299cf1c2a37d
patch 8.2.1264: terminal getwinpos() test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
21295
diff
changeset
|
537 call term_sendkeys(buf, ":echo getwinpos(500)\<CR>") |
21295
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
538 |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
539 " Find the output of getwinpos() in the bottom line. |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
540 let rows = term_getsize(buf)[0] |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
541 call WaitForAssert({-> assert_match('\[\d\+, \d\+\]', term_getline(buf, rows))}) |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
542 let line = term_getline(buf, rows) |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
543 let xpos = str2nr(substitute(line, '\[\(\d\+\), \d\+\]', '\1', '')) |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
544 let ypos = str2nr(substitute(line, '\[\d\+, \(\d\+\)\]', '\1', '')) |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
545 |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
546 " Position must be bigger than the getwinpos() result of Vim itself. |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
547 " The calculation in the console assumes a 10 x 7 character cell. |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
548 " In the GUI it can be more, let's assume a 20 x 14 cell. |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
549 " And then add 100 / 200 tolerance. |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
550 let [xroot, yroot] = getwinpos() |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
551 let winpos = 50->getwinpos() |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
552 call assert_equal(xroot, winpos[0]) |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
553 call assert_equal(yroot, winpos[1]) |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
554 let [winrow, wincol] = win_screenpos('.') |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
555 let xoff = wincol * (has('gui_running') ? 14 : 7) + 100 |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
556 let yoff = winrow * (has('gui_running') ? 20 : 10) + 200 |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
557 call assert_inrange(xroot + 2, xroot + xoff, xpos) |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
558 call assert_inrange(yroot + 2, yroot + yoff, ypos) |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
559 |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
560 call TermWait(buf) |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
561 call term_sendkeys(buf, ":q\<CR>") |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
562 call StopVimInTerminal(buf) |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
563 exe buf . 'bwipe!' |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
564 set splitright& |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
565 only! |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
566 endfunc |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
567 |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
568 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
569 " vim: shiftwidth=2 sts=2 expandtab |