Mercurial > vim
annotate src/testdir/test_terminal3.vim @ 33353:b59205d0567e v9.0.1939
patch 9.0.1939: still a problem when processing LSP RPC requests
Commit: https://github.com/vim/vim/commit/b80ae6cec34639abfb1a7080fb633346a81a5770
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sun Sep 24 23:38:46 2023 +0200
patch 9.0.1939: still a problem when processing LSP RPC requests
Problem: still a problem when processing LSP RPC requests
Solution: When processing async LSP RPC requests, compare sequence
numbers only in response messages
A LSP request message can be sent to the language server either
synchronously (ch_evalexpr) or asynchronously (ch_sendexpr). In both
cases, when looking for response messages by using the sequence number,
LSP requests messages from the language server with the same sequence
number should not be used. Patch 9.0.1927 fixed this issue for
synchronous requests. This PR fixes the issue for asynchronous requests
and adds additional tests.
closes: #13158
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 24 Sep 2023 23:45:08 +0200 |
parents | 8f15c56ff2fb |
children | 286bee19bc96 |
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, {}) |
31780
8f15c56ff2fb
patch 9.0.1222: terminal tests are flaky on MacOS
Bram Moolenaar <Bram@vim.org>
parents:
31037
diff
changeset
|
21 call TermWait(buf) |
30865
c8ebe35b2475
patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
28580
diff
changeset
|
22 call writefile(["\<Esc>[?1047h"], 'Xtext', 'D') |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 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
|
24 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
|
25 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
26 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
|
27 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
|
28 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
|
29 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
30 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
|
31 exe buf . "bwipe!" |
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 |
26193
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
69 " Check a terminal with different colors |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
70 func Terminal_color(group_name, highlight_cmds, highlight_opt, open_cmds) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
71 CheckRunVimInTerminal |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
72 CheckUnix |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
73 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
74 let lines = [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
75 \ 'call setline(1, range(20))', |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
76 \ 'func OpenTerm()', |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
77 \ ' set noruler', |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
78 \ " call term_start('cat', #{vertical: 1, " .. a:highlight_opt .. "})", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
79 \ ] + a:open_cmds + [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
80 \ 'endfunc', |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
81 \ ] + a:highlight_cmds |
30865
c8ebe35b2475
patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
28580
diff
changeset
|
82 call writefile(lines, 'XtermStart', 'D') |
26193
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
83 let buf = RunVimInTerminal('-S XtermStart', #{rows: 15}) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
84 call TermWait(buf, 100) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
85 call term_sendkeys(buf, ":call OpenTerm()\<CR>") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
86 call TermWait(buf, 50) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
87 call term_sendkeys(buf, "hello\<CR>") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
88 call VerifyScreenDump(buf, 'Test_terminal_color_' .. a:group_name, {}) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
89 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
90 call term_sendkeys(buf, "\<C-D>") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
91 call TermWait(buf, 50) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
92 call StopVimInTerminal(buf) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
93 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
94 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
95 func Test_terminal_color_Terminal() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
96 call Terminal_color("Terminal", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
97 \ "highlight Terminal ctermfg=blue ctermbg=yellow", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
98 \ ], "", []) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
99 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
100 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
101 func Test_terminal_color_group() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
102 call Terminal_color("MyTermCol", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
103 \ "highlight MyTermCol ctermfg=darkgreen ctermbg=lightblue", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
104 \ ], "term_highlight: 'MyTermCol',", []) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
105 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
106 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
107 func Test_terminal_color_wincolor() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
108 call Terminal_color("MyWinCol", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
109 \ "highlight MyWinCol ctermfg=red ctermbg=darkyellow", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
110 \ ], "", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
111 \ 'set wincolor=MyWinCol', |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
112 \ ]) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
113 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
114 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
115 func Test_terminal_color_group_over_Terminal() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
116 call Terminal_color("MyTermCol_over_Terminal", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
117 \ "highlight Terminal ctermfg=blue ctermbg=yellow", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
118 \ "highlight MyTermCol ctermfg=darkgreen ctermbg=lightblue", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
119 \ ], "term_highlight: 'MyTermCol',", []) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
120 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
121 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
122 func Test_terminal_color_wincolor_over_group() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
123 call Terminal_color("MyWinCol_over_group", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
124 \ "highlight MyTermCol ctermfg=darkgreen ctermbg=lightblue", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
125 \ "highlight MyWinCol ctermfg=red ctermbg=darkyellow", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
126 \ ], "term_highlight: 'MyTermCol',", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
127 \ 'set wincolor=MyWinCol', |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
128 \ ]) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
129 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
130 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
131 func Test_terminal_color_wincolor_split() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
132 CheckRunVimInTerminal |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
133 CheckUnix |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
134 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
135 let lines = [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
136 \ 'call setline(1, range(20))', |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
137 \ 'func OpenTerm()', |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
138 \ ' set noruler', |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
139 \ " call term_start('cat', #{vertical: 1, term_highlight: 'MyTermCol'})", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
140 \ 'endfunc', |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
141 \ 'highlight MyTermCol ctermfg=darkgreen ctermbg=lightblue', |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
142 \ 'highlight MyWinCol ctermfg=red ctermbg=darkyellow', |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
143 \ 'highlight MyWinCol2 ctermfg=black ctermbg=blue', |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
144 \ ] |
30865
c8ebe35b2475
patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
28580
diff
changeset
|
145 call writefile(lines, 'XtermStart', 'D') |
26193
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
146 let buf = RunVimInTerminal('-S XtermStart', #{rows: 15}) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
147 call TermWait(buf, 100) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
148 call term_sendkeys(buf, ":call OpenTerm()\<CR>") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
149 call TermWait(buf, 50) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
150 call term_sendkeys(buf, "hello\<CR>") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
151 call TermWait(buf, 50) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
152 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
153 call term_sendkeys(buf, "\<C-W>:split\<CR>") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
154 call term_sendkeys(buf, "\<C-W>:set wincolor=MyWinCol\<CR>") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
155 call VerifyScreenDump(buf, 'Test_terminal_wincolor_split_MyWinCol', {}) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
156 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
157 call term_sendkeys(buf, "\<C-W>b:2sb\<CR>") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
158 call term_sendkeys(buf, "\<C-W>:set wincolor=MyWinCol2\<CR>") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
159 call VerifyScreenDump(buf, 'Test_terminal_wincolor_split_MyWinCol2', {}) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
160 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
161 call term_sendkeys(buf, "\<C-D>") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
162 call TermWait(buf, 50) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
163 call StopVimInTerminal(buf) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
164 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
165 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
166 func Test_terminal_color_transp_Terminal() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
167 call Terminal_color("transp_Terminal", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
168 \ "highlight Terminal ctermfg=blue", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
169 \ ], "", []) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
170 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
171 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
172 func Test_terminal_color_transp_group() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
173 call Terminal_color("transp_MyTermCol", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
174 \ "highlight MyTermCol ctermfg=darkgreen", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
175 \ ], "term_highlight: 'MyTermCol',", []) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
176 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
177 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
178 func Test_terminal_color_transp_wincolor() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
179 call Terminal_color("transp_MyWinCol", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
180 \ "highlight MyWinCol ctermfg=red", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
181 \ ], "", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
182 \ 'set wincolor=MyWinCol', |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
183 \ ]) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
184 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
185 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
186 func Test_terminal_color_gui_Terminal() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
187 CheckFeature termguicolors |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
188 call Terminal_color("gui_Terminal", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
189 \ "set termguicolors", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
190 \ "highlight Terminal guifg=#3344ff guibg=#b0a700", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
191 \ ], "", []) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
192 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
193 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
194 func Test_terminal_color_gui_group() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
195 CheckFeature termguicolors |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
196 call Terminal_color("gui_MyTermCol", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
197 \ "set termguicolors", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
198 \ "highlight MyTermCol guifg=#007800 guibg=#6789ff", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
199 \ ], "term_highlight: 'MyTermCol',", []) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
200 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
201 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
202 func Test_terminal_color_gui_wincolor() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
203 CheckFeature termguicolors |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
204 call Terminal_color("gui_MyWinCol", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
205 \ "set termguicolors", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
206 \ "highlight MyWinCol guifg=#fe1122 guibg=#818100", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
207 \ ], "", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
208 \ 'set wincolor=MyWinCol', |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
209 \ ]) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
210 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
211 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
212 func Test_terminal_color_gui_transp_Terminal() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
213 CheckFeature termguicolors |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
214 call Terminal_color("gui_transp_Terminal", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
215 \ "set termguicolors", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
216 \ "highlight Terminal guifg=#3344ff", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
217 \ ], "", []) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
218 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
219 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
220 func Test_terminal_color_gui_transp_group() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
221 CheckFeature termguicolors |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
222 call Terminal_color("gui_transp_MyTermCol", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
223 \ "set termguicolors", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
224 \ "highlight MyTermCol guifg=#007800", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
225 \ ], "term_highlight: 'MyTermCol',", []) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
226 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
227 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
228 func Test_terminal_color_gui_transp_wincolor() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
229 CheckFeature termguicolors |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
230 call Terminal_color("gui_transp_MyWinCol", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
231 \ "set termguicolors", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
232 \ "highlight MyWinCol guifg=#fe1122", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
233 \ ], "", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
234 \ 'set wincolor=MyWinCol', |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
235 \ ]) |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
236 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
237 |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
238 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
|
239 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
240 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
241 let text =<< trim END |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
242 some text |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
243 to edit |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
244 in a popup window |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
245 END |
30865
c8ebe35b2475
patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
28580
diff
changeset
|
246 call writefile(text, 'Xtext', 'D') |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
247 let cmd = GetVimCommandCleanTerm() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
248 let lines = [ |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
249 \ '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
|
250 \ 'hi PopTerm ctermbg=grey', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
251 \ 'func OpenTerm(setColor)', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
252 \ " set noruler", |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
253 \ " 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
|
254 \ ' 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
|
255 \ ' if a:setColor', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
256 \ ' 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
|
257 \ ' endif', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
258 \ 'endfunc', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
259 \ 'func HidePopup()', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
260 \ ' 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
|
261 \ 'endfunc', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
262 \ 'func ClosePopup()', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
263 \ ' 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
|
264 \ 'endfunc', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
265 \ 'func ReopenPopup()', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
266 \ ' 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
|
267 \ 'endfunc', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
268 \ ] |
30865
c8ebe35b2475
patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
28580
diff
changeset
|
269 call writefile(lines, 'XtermPopup', 'D') |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
270 let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15}) |
31029
bf8e9ef40006
patch 9.0.0849: terminal mouse test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
30865
diff
changeset
|
271 call TermWait(buf, 200) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
272 call term_sendkeys(buf, ":call OpenTerm(0)\<CR>") |
31029
bf8e9ef40006
patch 9.0.0849: terminal mouse test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
30865
diff
changeset
|
273 call TermWait(buf, 800) |
bf8e9ef40006
patch 9.0.0849: terminal mouse test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
30865
diff
changeset
|
274 call term_sendkeys(buf, ":\<CR>") |
23406
24ce202a7d68
patch 8.2.2246: cursor keys not recognized at the hit-Enter prompt
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
275 call TermWait(buf, 500) |
21253
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, "\<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
|
277 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
|
278 |
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, ":q\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
280 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
|
281 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
282 call term_sendkeys(buf, ":call OpenTerm(1)\<CR>") |
31029
bf8e9ef40006
patch 9.0.0849: terminal mouse test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
30865
diff
changeset
|
283 call TermWait(buf, 800) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
284 call term_sendkeys(buf, ":set hlsearch\<CR>") |
31029
bf8e9ef40006
patch 9.0.0849: terminal mouse test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
30865
diff
changeset
|
285 call TermWait(buf, 500) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
286 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
|
287 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
|
288 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
289 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
|
290 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
|
291 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
|
292 call TermWait(buf, 50) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
293 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
294 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
|
295 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
|
296 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
297 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
|
298 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
|
299 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
300 " 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
|
301 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
|
302 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
|
303 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
304 " 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
|
305 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
|
306 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
|
307 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
308 call TermWait(buf, 50) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
309 call term_sendkeys(buf, ":q\<CR>") |
23406
24ce202a7d68
patch 8.2.2246: cursor keys not recognized at the hit-Enter prompt
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
310 call TermWait(buf, 250) " wait for terminal to vanish |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
311 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
312 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
313 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
314 |
23229
b545334ae654
patch 8.2.2160: various typos
Bram Moolenaar <Bram@vim.org>
parents:
22780
diff
changeset
|
315 " Check a terminal in popup window uses the default minimum size. |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
316 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
|
317 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
318 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
319 let text =<< trim END |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
320 another text |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
321 to show |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
322 in a popup window |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
323 END |
30865
c8ebe35b2475
patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
28580
diff
changeset
|
324 call writefile(text, 'Xtext', 'D') |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
325 let lines = [ |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
326 \ '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
|
327 \ 'func OpenTerm()', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
328 \ " 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
|
329 \ ' 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
|
330 \ 'endfunc', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
331 \ ] |
30865
c8ebe35b2475
patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
28580
diff
changeset
|
332 call writefile(lines, 'XtermPopup', 'D') |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
333 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
|
334 call TermWait(buf, 100) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
335 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
|
336 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
|
337 call TermWait(buf, 50) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
338 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
|
339 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
|
340 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
341 call TermWait(buf, 50) |
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, ":q\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
343 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
|
344 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
345 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
346 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
347 " Check a terminal in popup window with different colors |
26193
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
348 func Terminal_in_popup_color(group_name, highlight_cmds, highlight_opt, popup_cmds, popup_opt) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
349 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
350 CheckUnix |
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 let lines = [ |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
353 \ '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
|
354 \ 'func OpenTerm()', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
355 \ " 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
|
356 \ .. a:highlight_opt .. "})", |
26193
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
357 \ ' let g:winid = popup_create(s:buf, #{border: [], ' |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
358 \ .. a:popup_opt .. '})', |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
359 \ ] + a:popup_cmds + [ |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
360 \ 'endfunc', |
26193
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
361 \ ] + a:highlight_cmds |
30865
c8ebe35b2475
patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
28580
diff
changeset
|
362 call writefile(lines, 'XtermPopup', 'D') |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
363 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
|
364 call TermWait(buf, 100) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
365 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
|
366 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
|
367 call TermWait(buf, 50) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
368 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
|
369 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
|
370 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
371 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
|
372 call TermWait(buf, 50) |
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, ":q\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
374 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
|
375 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
376 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
377 |
26193
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
378 func Test_terminal_in_popup_color_Terminal() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
379 call Terminal_in_popup_color("Terminal", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
380 \ "highlight Terminal ctermfg=blue ctermbg=yellow", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
381 \ ], "", [], "") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
382 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
383 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
384 func Test_terminal_in_popup_color_group() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
385 call Terminal_in_popup_color("MyTermCol", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
386 \ "highlight MyTermCol ctermfg=darkgreen ctermbg=lightblue", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
387 \ ], "term_highlight: 'MyTermCol',", [], "") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
388 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
389 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
390 func Test_terminal_in_popup_color_wincolor() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
391 call Terminal_in_popup_color("MyWinCol", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
392 \ "highlight MyWinCol ctermfg=red ctermbg=darkyellow", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
393 \ ], "", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
394 \ 'call setwinvar(g:winid, "&wincolor", "MyWinCol")', |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
395 \ ], "") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
396 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
397 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
398 func Test_terminal_in_popup_color_popup_highlight() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
399 call Terminal_in_popup_color("MyPopupHlCol", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
400 \ "highlight MyPopupHlCol ctermfg=cyan ctermbg=green", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
401 \ ], "", [], "highlight: 'MyPopupHlCol'") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
402 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
403 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
404 func Test_terminal_in_popup_color_group_over_Terminal() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
405 call Terminal_in_popup_color("MyTermCol_over_Terminal", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
406 \ "highlight Terminal ctermfg=blue ctermbg=yellow", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
407 \ "highlight MyTermCol ctermfg=darkgreen ctermbg=lightblue", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
408 \ ], "term_highlight: 'MyTermCol',", [], "") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
409 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
410 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
411 func Test_terminal_in_popup_color_wincolor_over_group() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
412 call Terminal_in_popup_color("MyWinCol_over_group", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
413 \ "highlight MyTermCol ctermfg=darkgreen ctermbg=lightblue", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
414 \ "highlight MyWinCol ctermfg=red ctermbg=darkyellow", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
415 \ ], "term_highlight: 'MyTermCol',", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
416 \ 'call setwinvar(g:winid, "&wincolor", "MyWinCol")', |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
417 \ ], "") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
418 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
419 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
420 func Test_terminal_in_popup_color_transp_Terminal() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
421 call Terminal_in_popup_color("transp_Terminal", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
422 \ "highlight Terminal ctermfg=blue", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
423 \ ], "", [], "") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
424 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
425 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
426 func Test_terminal_in_popup_color_transp_group() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
427 call Terminal_in_popup_color("transp_MyTermCol", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
428 \ "highlight MyTermCol ctermfg=darkgreen", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
429 \ ], "term_highlight: 'MyTermCol',", [], "") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
430 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
431 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
432 func Test_terminal_in_popup_color_transp_wincolor() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
433 call Terminal_in_popup_color("transp_MyWinCol", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
434 \ "highlight MyWinCol ctermfg=red", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
435 \ ], "", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
436 \ 'call setwinvar(g:winid, "&wincolor", "MyWinCol")', |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
437 \ ], "") |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
438 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
439 |
26193
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
440 func Test_terminal_in_popup_color_transp_popup_highlight() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
441 call Terminal_in_popup_color("transp_MyPopupHlCol", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
442 \ "highlight MyPopupHlCol ctermfg=cyan", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
443 \ ], "", [], "highlight: 'MyPopupHlCol'") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
444 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
445 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
446 func Test_terminal_in_popup_color_gui_Terminal() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
447 CheckFeature termguicolors |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
448 call Terminal_in_popup_color("gui_Terminal", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
449 \ "set termguicolors", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
450 \ "highlight Terminal guifg=#3344ff guibg=#b0a700", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
451 \ ], "", [], "") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
452 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
453 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
454 func Test_terminal_in_popup_color_gui_group() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
455 CheckFeature termguicolors |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
456 call Terminal_in_popup_color("gui_MyTermCol", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
457 \ "set termguicolors", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
458 \ "highlight MyTermCol guifg=#007800 guibg=#6789ff", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
459 \ ], "term_highlight: 'MyTermCol',", [], "") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
460 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
461 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
462 func Test_terminal_in_popup_color_gui_wincolor() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
463 CheckFeature termguicolors |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
464 call Terminal_in_popup_color("gui_MyWinCol", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
465 \ "set termguicolors", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
466 \ "highlight MyWinCol guifg=#fe1122 guibg=#818100", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
467 \ ], "", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
468 \ 'call setwinvar(g:winid, "&wincolor", "MyWinCol")', |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
469 \ ], "") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
470 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
471 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
472 func Test_terminal_in_popup_color_gui_popup_highlight() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
473 CheckFeature termguicolors |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
474 call Terminal_in_popup_color("gui_MyPopupHlCol", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
475 \ "set termguicolors", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
476 \ "highlight MyPopupHlCol guifg=#00e8f0 guibg=#126521", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
477 \ ], "", [], "highlight: 'MyPopupHlCol'") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
478 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
479 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
480 func Test_terminal_in_popup_color_gui_transp_Terminal() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
481 CheckFeature termguicolors |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
482 call Terminal_in_popup_color("gui_transp_Terminal", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
483 \ "set termguicolors", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
484 \ "highlight Terminal guifg=#3344ff", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
485 \ ], "", [], "") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
486 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
487 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
488 func Test_terminal_in_popup_color_gui_transp_group() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
489 CheckFeature termguicolors |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
490 call Terminal_in_popup_color("gui_transp_MyTermCol", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
491 \ "set termguicolors", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
492 \ "highlight MyTermCol guifg=#007800", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
493 \ ], "term_highlight: 'MyTermCol',", [], "") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
494 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
495 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
496 func Test_terminal_in_popup_color_gui_transp_wincolor() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
497 CheckFeature termguicolors |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
498 call Terminal_in_popup_color("gui_transp_MyWinCol", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
499 \ "set termguicolors", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
500 \ "highlight MyWinCol guifg=#fe1122", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
501 \ ], "", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
502 \ 'call setwinvar(g:winid, "&wincolor", "MyWinCol")', |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
503 \ ], "") |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
504 endfunc |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
505 |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
506 func Test_terminal_in_popup_color_gui_transp_popup_highlight() |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
507 CheckFeature termguicolors |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
508 call Terminal_in_popup_color("gui_transp_MyPopupHlCol", [ |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
509 \ "set termguicolors", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
510 \ "highlight MyPopupHlCol guifg=#00e8f0", |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
511 \ ], "", [], "highlight: 'MyPopupHlCol'") |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
512 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
513 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
514 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
|
515 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
|
516 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
|
517 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
|
518 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
|
519 call popup_close(win1) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
520 exe buf1 .. 'bwipe!' |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
521 exe buf2 .. 'bwipe!' |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
522 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
523 |
28580
39df510f97c3
patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents:
27120
diff
changeset
|
524 func Test_escape_popup_terminal() |
39df510f97c3
patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents:
27120
diff
changeset
|
525 set hidden |
39df510f97c3
patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents:
27120
diff
changeset
|
526 |
39df510f97c3
patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents:
27120
diff
changeset
|
527 " Cannot escape a terminal popup window using win_gotoid |
39df510f97c3
patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents:
27120
diff
changeset
|
528 let prev_win = win_getid() |
39df510f97c3
patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents:
27120
diff
changeset
|
529 eval term_start('sh', #{hidden: 1, term_finish: 'close'})->popup_create({}) |
39df510f97c3
patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents:
27120
diff
changeset
|
530 call assert_fails("call win_gotoid(" .. prev_win .. ")", 'E863:') |
39df510f97c3
patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents:
27120
diff
changeset
|
531 |
39df510f97c3
patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents:
27120
diff
changeset
|
532 call popup_clear(1) |
39df510f97c3
patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents:
27120
diff
changeset
|
533 set hidden& |
39df510f97c3
patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents:
27120
diff
changeset
|
534 endfunc |
39df510f97c3
patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents:
27120
diff
changeset
|
535 |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
536 func Test_issue_5607() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
537 let wincount = winnr('$') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
538 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
|
539 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
|
540 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
|
541 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
542 let old_wincolor = &wincolor |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
543 try |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
544 set wincolor= |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
545 finally |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
546 let &wincolor = old_wincolor |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
547 bw! |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
548 endtry |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
549 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
550 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
551 func Test_hidden_terminal() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
552 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
|
553 call assert_equal('', bufname('^$')) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
554 call StopShellInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
555 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
556 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
557 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
|
558 CheckExecutable sh |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
559 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
560 set hidden |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
561 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
|
562 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
|
563 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
|
564 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
565 call popup_clear(1) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
566 set hidden& |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
567 endfunc |
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 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
|
570 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
571 CheckUnix |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
572 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
573 let lines =<< trim EOL |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
574 put='some text' |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
575 term |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
576 startinsert |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
577 EOL |
30865
c8ebe35b2475
patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
28580
diff
changeset
|
578 call writefile(lines, 'XTest_startinsert', 'D') |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
579 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
|
580 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
581 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
|
582 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
|
583 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
|
584 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
|
585 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
|
586 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
587 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
588 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
589 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
590 " 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
|
591 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
|
592 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
|
593 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
|
594 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
|
595 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
|
596 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
|
597 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
|
598 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
|
599 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
|
600 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
|
601 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
|
602 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
|
603 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
|
604 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
|
605 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
|
606 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
|
607 endif |
23984
e27b5529dc6a
patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents:
23406
diff
changeset
|
608 let buf = term_start('echo') |
e27b5529dc6a
patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents:
23406
diff
changeset
|
609 call assert_fails('call term_setapi(' .. buf .. ', {})', 'E731:') |
e27b5529dc6a
patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents:
23406
diff
changeset
|
610 call assert_fails('call term_setkill(' .. buf .. ', {})', 'E731:') |
e27b5529dc6a
patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents:
23406
diff
changeset
|
611 call assert_fails('call term_setrestore(' .. buf .. ', {})', 'E731:') |
e27b5529dc6a
patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents:
23406
diff
changeset
|
612 exe buf . "bwipe!" |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
613 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
614 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
615 " 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
|
616 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
|
617 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
618 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
619 let buf = RunVimInTerminal('', {}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
620 call term_sendkeys(buf, ":set nocompatible\<CR>") |
23406
24ce202a7d68
patch 8.2.2246: cursor keys not recognized at the hit-Enter prompt
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
621 call term_sendkeys(buf, ":set timeoutlen=20\<CR>") |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
622 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
623 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
|
624 \ "\<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
|
625 \ "\<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
|
626 \ "\<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
|
627 \ "\<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
|
628 \ "\<S-Down>"] |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
629 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
|
630 \ '<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
|
631 \ '<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
|
632 \ '<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
|
633 \ '<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
|
634 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
635 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
|
636 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
|
637 call term_sendkeys(buf, "\<C-U>\<C-K>" .. keys[i]) |
23406
24ce202a7d68
patch 8.2.2246: cursor keys not recognized at the hit-Enter prompt
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
638 call WaitForAssert({-> assert_equal(output[i], term_getline(buf, 1))}, 200) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
639 endfor |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
640 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
641 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
|
642 \ "\<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
|
643 \ "\<kMinus>", "\<kMultiply>", "\<kDivide>"] |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
644 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
|
645 \ '6', '7', '8', '9', '.', '+', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
646 \ '-', '*', '/'] |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
647 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
|
648 " 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
|
649 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
|
650 continue |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
651 endif |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
652 call term_sendkeys(buf, "\<C-U>" .. keypad_keys[i]) |
23406
24ce202a7d68
patch 8.2.2246: cursor keys not recognized at the hit-Enter prompt
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
653 call WaitForAssert({-> assert_equal(keypad_output[i], term_getline(buf, 1))}, 100) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
654 endfor |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
655 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
656 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
|
657 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
|
658 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
659 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
660 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
661 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
662 " 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
|
663 func Test_term_mouse() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
664 CheckNotGui |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
665 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
666 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
667 let save_mouse = &mouse |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
668 let save_term = &term |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
669 let save_ttymouse = &ttymouse |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
670 let save_clipboard = &clipboard |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
671 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
|
672 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
673 let lines =<< trim END |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
674 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
|
675 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
|
676 vim emacs sublime nano |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
677 END |
30865
c8ebe35b2475
patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
28580
diff
changeset
|
678 call writefile(lines, 'Xtest_mouse', 'D') |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
679 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
680 " 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
|
681 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
|
682 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
|
683 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
|
684 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
|
685 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
|
686 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
|
687 call TermWait(buf) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
688 redraw! |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
689 |
31037
ac16c9a934ad
patch 9.0.0853: terminal mouse test is still flaky on MacOS M1
Bram Moolenaar <Bram@vim.org>
parents:
31033
diff
changeset
|
690 " Funcref used in WaitFor() to check that the "Xbuf" file is readable and |
ac16c9a934ad
patch 9.0.0853: terminal mouse test is still flaky on MacOS M1
Bram Moolenaar <Bram@vim.org>
parents:
31033
diff
changeset
|
691 " has some contents. This avoids a "List index out of range" error when the |
ac16c9a934ad
patch 9.0.0853: terminal mouse test is still flaky on MacOS M1
Bram Moolenaar <Bram@vim.org>
parents:
31033
diff
changeset
|
692 " file hasn't been written yet. |
ac16c9a934ad
patch 9.0.0853: terminal mouse test is still flaky on MacOS M1
Bram Moolenaar <Bram@vim.org>
parents:
31033
diff
changeset
|
693 let XbufNotEmpty = {-> filereadable('Xbuf') && len(readfile('Xbuf')) > 0} |
31029
bf8e9ef40006
patch 9.0.0849: terminal mouse test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
30865
diff
changeset
|
694 |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
695 " 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
|
696 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
|
697 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
|
698 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
|
699 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
|
700 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
701 " 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
|
702 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
|
703 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
|
704 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
|
705 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
|
706 call TermWait(buf, 50) |
31029
bf8e9ef40006
patch 9.0.0849: terminal mouse test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
30865
diff
changeset
|
707 call delete('Xbuf') |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
708 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
|
709 call TermWait(buf, 50) |
31037
ac16c9a934ad
patch 9.0.0853: terminal mouse test is still flaky on MacOS M1
Bram Moolenaar <Bram@vim.org>
parents:
31033
diff
changeset
|
710 call WaitFor(XbufNotEmpty) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
711 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
|
712 call assert_equal([3, 8], pos[1:2]) |
31029
bf8e9ef40006
patch 9.0.0849: terminal mouse test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
30865
diff
changeset
|
713 call delete('Xbuf') |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
714 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
715 " 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
|
716 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
|
717 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
|
718 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
|
719 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
|
720 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
|
721 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>") |
31037
ac16c9a934ad
patch 9.0.0853: terminal mouse test is still flaky on MacOS M1
Bram Moolenaar <Bram@vim.org>
parents:
31033
diff
changeset
|
722 call WaitFor(XbufNotEmpty) |
31033
3ad8db9a1e03
patch 9.0.0851: terminal mouse test is still flaky
Bram Moolenaar <Bram@vim.org>
parents:
31029
diff
changeset
|
723 call WaitForAssert({-> assert_equal('yellow', readfile('Xbuf')[0])}) |
31029
bf8e9ef40006
patch 9.0.0849: terminal mouse test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
30865
diff
changeset
|
724 call delete('Xbuf') |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
725 |
26193
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
726 " Test for selecting text using double click |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
727 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
|
728 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
|
729 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
|
730 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
|
731 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
|
732 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>") |
31037
ac16c9a934ad
patch 9.0.0853: terminal mouse test is still flaky on MacOS M1
Bram Moolenaar <Bram@vim.org>
parents:
31033
diff
changeset
|
733 call WaitFor(XbufNotEmpty) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
734 call assert_equal('three four', readfile('Xbuf')[0]) |
31029
bf8e9ef40006
patch 9.0.0849: terminal mouse test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
30865
diff
changeset
|
735 call delete('Xbuf') |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
736 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
737 " 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
|
738 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
|
739 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
|
740 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
|
741 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>") |
31037
ac16c9a934ad
patch 9.0.0853: terminal mouse test is still flaky on MacOS M1
Bram Moolenaar <Bram@vim.org>
parents:
31033
diff
changeset
|
742 call WaitFor(XbufNotEmpty) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
743 call assert_equal("vim emacs sublime nano\n", readfile('Xbuf')[0]) |
31029
bf8e9ef40006
patch 9.0.0849: terminal mouse test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
30865
diff
changeset
|
744 call delete('Xbuf') |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
745 |
26193
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
24273
diff
changeset
|
746 " Test for selecting a block using quadruple click |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
747 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
|
748 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
|
749 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
|
750 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
|
751 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
|
752 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>") |
31037
ac16c9a934ad
patch 9.0.0853: terminal mouse test is still flaky on MacOS M1
Bram Moolenaar <Bram@vim.org>
parents:
31033
diff
changeset
|
753 call WaitFor(XbufNotEmpty) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
754 call assert_equal("ree\nyel\nsub", readfile('Xbuf')[0]) |
31029
bf8e9ef40006
patch 9.0.0849: terminal mouse test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
30865
diff
changeset
|
755 call delete('Xbuf') |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
756 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
757 " 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
|
758 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
|
759 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
|
760 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
|
761 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
|
762 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
|
763 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>") |
31037
ac16c9a934ad
patch 9.0.0853: terminal mouse test is still flaky on MacOS M1
Bram Moolenaar <Bram@vim.org>
parents:
31033
diff
changeset
|
764 call WaitFor(XbufNotEmpty) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
765 call assert_equal("n yellow", readfile('Xbuf')[0]) |
31029
bf8e9ef40006
patch 9.0.0849: terminal mouse test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
30865
diff
changeset
|
766 call delete('Xbuf') |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
767 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
768 " 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
|
769 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
|
770 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
|
771 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
|
772 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
|
773 call term_sendkeys(buf, ":call writefile([getline(2)], 'Xbuf')\<CR>") |
31037
ac16c9a934ad
patch 9.0.0853: terminal mouse test is still flaky on MacOS M1
Bram Moolenaar <Bram@vim.org>
parents:
31033
diff
changeset
|
774 call WaitFor(XbufNotEmpty) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
775 call assert_equal("red bright blue", readfile('Xbuf')[0][-15:]) |
31029
bf8e9ef40006
patch 9.0.0849: terminal mouse test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
30865
diff
changeset
|
776 call delete('Xbuf') |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
777 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
778 " cleanup |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
779 call TermWait(buf) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
780 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
781 let &mouse = save_mouse |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
782 let &term = save_term |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
783 let &ttymouse = save_ttymouse |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
784 let &clipboard = save_clipboard |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
785 set mousetime& |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
786 call delete('Xbuf') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
787 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
788 |
24268
9257f3980f4a
patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents:
23984
diff
changeset
|
789 " Test for sync buffer cwd with shell's pwd |
9257f3980f4a
patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents:
23984
diff
changeset
|
790 func Test_terminal_sync_shell_dir() |
9257f3980f4a
patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents:
23984
diff
changeset
|
791 CheckUnix |
9257f3980f4a
patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents:
23984
diff
changeset
|
792 " The test always use sh (see src/testdir/unix.vim). |
27120
2961745336b8
patch 8.2.4089: terminal test for current directory fails on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents:
27098
diff
changeset
|
793 " BSD's sh doesn't seem to play well with the OSC 7 escape sequence. |
2961745336b8
patch 8.2.4089: terminal test for current directory fails on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents:
27098
diff
changeset
|
794 CheckNotBSD |
24268
9257f3980f4a
patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents:
23984
diff
changeset
|
795 |
9257f3980f4a
patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents:
23984
diff
changeset
|
796 set asd |
9257f3980f4a
patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents:
23984
diff
changeset
|
797 " , is |
9257f3980f4a
patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents:
23984
diff
changeset
|
798 " 1. a valid character for directory names |
9257f3980f4a
patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents:
23984
diff
changeset
|
799 " 2. a reserved character in url-encoding |
9257f3980f4a
patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents:
23984
diff
changeset
|
800 let chars = ",a" |
9257f3980f4a
patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents:
23984
diff
changeset
|
801 " "," is url-encoded as '%2C' |
9257f3980f4a
patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents:
23984
diff
changeset
|
802 let chars_url = "%2Ca" |
27098
8bb07c88ac27
patch 8.2.4078: terminal test for current directory not used on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents:
26608
diff
changeset
|
803 let tmpfolder = fnamemodify(tempname(),':h') .. '/' .. chars |
8bb07c88ac27
patch 8.2.4078: terminal test for current directory not used on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents:
26608
diff
changeset
|
804 let tmpfolder_url = fnamemodify(tempname(),':h') .. '/' .. chars_url |
24268
9257f3980f4a
patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents:
23984
diff
changeset
|
805 call mkdir(tmpfolder, "p") |
9257f3980f4a
patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents:
23984
diff
changeset
|
806 let buf = Run_shell_in_terminal({}) |
27098
8bb07c88ac27
patch 8.2.4078: terminal test for current directory not used on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents:
26608
diff
changeset
|
807 call term_sendkeys(buf, "echo $'\\e\]7;file://" .. tmpfolder_url .. "\\a'\<CR>") |
8bb07c88ac27
patch 8.2.4078: terminal test for current directory not used on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents:
26608
diff
changeset
|
808 "call term_sendkeys(buf, "cd " .. tmpfolder .. "\<CR>") |
24268
9257f3980f4a
patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents:
23984
diff
changeset
|
809 call TermWait(buf) |
9257f3980f4a
patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents:
23984
diff
changeset
|
810 if has("mac") |
27098
8bb07c88ac27
patch 8.2.4078: terminal test for current directory not used on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents:
26608
diff
changeset
|
811 let expected = "/private" .. tmpfolder |
24268
9257f3980f4a
patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents:
23984
diff
changeset
|
812 else |
9257f3980f4a
patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents:
23984
diff
changeset
|
813 let expected = tmpfolder |
9257f3980f4a
patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents:
23984
diff
changeset
|
814 endif |
9257f3980f4a
patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents:
23984
diff
changeset
|
815 call assert_equal(expected, getcwd(winnr())) |
24273
477b0a892a85
patch 8.2.2678: test for 'autoshelldir' does not reset the option
Bram Moolenaar <Bram@vim.org>
parents:
24268
diff
changeset
|
816 |
477b0a892a85
patch 8.2.2678: test for 'autoshelldir' does not reset the option
Bram Moolenaar <Bram@vim.org>
parents:
24268
diff
changeset
|
817 set noasd |
24268
9257f3980f4a
patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents:
23984
diff
changeset
|
818 endfunc |
9257f3980f4a
patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents:
23984
diff
changeset
|
819 |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
820 " 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
|
821 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
|
822 CheckUnix |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
823 CheckNotGui |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
824 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
825 CheckFeature clipboard_working |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
826 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
827 let save_mouse = &mouse |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
828 let save_term = &term |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
829 let save_ttymouse = &ttymouse |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
830 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
|
831 set clipboard=autoselectml |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
832 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
833 let lines =<< trim END |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
834 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
|
835 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
|
836 vim emacs sublime nano |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
837 END |
30865
c8ebe35b2475
patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
28580
diff
changeset
|
838 call writefile(lines, 'Xtest_modeless', 'D') |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
839 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
840 " 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
|
841 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
|
842 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
|
843 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
|
844 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
|
845 call TermWait(buf) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
846 redraw! |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
847 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
848 " 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
|
849 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
|
850 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
|
851 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
|
852 call TermWait(buf) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
853 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
|
854 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
855 " 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
|
856 let @* = 'clean' |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
857 " 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
|
858 sleep 100m |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
859 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
|
860 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
|
861 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
|
862 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
|
863 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
864 " cleanup |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
865 call TermWait(buf) |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
866 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
867 let &mouse = save_mouse |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
868 let &term = save_term |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
869 let &ttymouse = save_ttymouse |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
870 set mousetime& clipboard& |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
871 new | only! |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
872 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
873 |
21295
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
874 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
|
875 CheckRunVimInTerminal |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
876 |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
877 " 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
|
878 split |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
879 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
|
880 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
|
881 |
21427
299cf1c2a37d
patch 8.2.1264: terminal getwinpos() test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
21295
diff
changeset
|
882 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
|
883 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
|
884 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
|
885 |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
886 " 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
|
887 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
|
888 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
|
889 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
|
890 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
|
891 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
|
892 |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
893 " 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
|
894 " 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
|
895 " 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
|
896 " 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
|
897 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
|
898 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
|
899 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
|
900 call assert_equal(yroot, winpos[1]) |
22093
b85e13213b11
patch 8.2.1596: using win_screenpos('.') in tests works but is wrong
Bram Moolenaar <Bram@vim.org>
parents:
21897
diff
changeset
|
901 let [winrow, wincol] = win_screenpos(0) |
21295
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
902 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
|
903 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
|
904 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
|
905 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
|
906 |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
907 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
|
908 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
|
909 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
|
910 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
|
911 only! |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
912 endfunc |
3e0d4782d0c6
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
913 |
26608
1eb62546e20c
patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
26193
diff
changeset
|
914 func Test_terminal_term_start_error() |
1eb62546e20c
patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
26193
diff
changeset
|
915 func s:term_start_error() abort |
1eb62546e20c
patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
26193
diff
changeset
|
916 try |
1eb62546e20c
patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
26193
diff
changeset
|
917 return term_start([[]]) |
1eb62546e20c
patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
26193
diff
changeset
|
918 catch |
1eb62546e20c
patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
26193
diff
changeset
|
919 return v:exception |
1eb62546e20c
patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
26193
diff
changeset
|
920 finally |
1eb62546e20c
patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
26193
diff
changeset
|
921 " |
1eb62546e20c
patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
26193
diff
changeset
|
922 endtry |
1eb62546e20c
patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
26193
diff
changeset
|
923 endfunc |
1eb62546e20c
patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
26193
diff
changeset
|
924 autocmd WinEnter * call type(0) |
1eb62546e20c
patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
26193
diff
changeset
|
925 |
1eb62546e20c
patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
26193
diff
changeset
|
926 " Must not crash in s:term_start_error, nor the exception thrown. |
1eb62546e20c
patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
26193
diff
changeset
|
927 let result = s:term_start_error() |
1eb62546e20c
patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
26193
diff
changeset
|
928 call assert_match('^Vim(return):E730:', result) |
1eb62546e20c
patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
26193
diff
changeset
|
929 |
1eb62546e20c
patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
26193
diff
changeset
|
930 autocmd! WinEnter |
1eb62546e20c
patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
26193
diff
changeset
|
931 delfunc s:term_start_error |
1eb62546e20c
patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
26193
diff
changeset
|
932 endfunc |
1eb62546e20c
patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
26193
diff
changeset
|
933 |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
934 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
935 " vim: shiftwidth=2 sts=2 expandtab |