annotate src/testdir/test_terminal3.vim @ 28841:77a00aa3e215 v8.2.4944

patch 8.2.4944: text properties are wrong after "cc" Commit: https://github.com/vim/vim/commit/d0b1a09f44654bb5e29b09de1311845200f17d90 Author: LemonBoy <thatlemon@gmail.com> Date: Thu May 12 18:45:18 2022 +0100 patch 8.2.4944: text properties are wrong after "cc" Problem: Text properties are wrong after "cc". (Axel Forsman) Solution: Pass the deleted byte count to inserted_bytes(). (closes https://github.com/vim/vim/issues/10412, closes #7737, closes #5763)
author Bram Moolenaar <Bram@vim.org>
date Thu, 12 May 2022 20:00:02 +0200
parents 39df510f97c3
children c8ebe35b2475
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Tests for the terminal window.
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " This is split in two, because it can take a lot of time.
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " See test_terminal.vim and test_terminal2.vim for further tests.
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 source check.vim
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 CheckFeature terminal
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 source shared.vim
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 source screendump.vim
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 source mouse.vim
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 source term_util.vim
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 let $PROMPT_COMMAND=''
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 func Test_terminal_altscreen()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 " somehow doesn't work on MS-Windows
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 CheckUnix
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 let cmd = "cat Xtext\<CR>"
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 let buf = term_start(&shell, {})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 call writefile(["\<Esc>[?1047h"], 'Xtext')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 call term_sendkeys(buf, cmd)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 call WaitForAssert({-> assert_equal(1, term_getaltscreen(buf))})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 call writefile(["\<Esc>[?1047l"], 'Xtext')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 call term_sendkeys(buf, cmd)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 call WaitForAssert({-> assert_equal(0, term_getaltscreen(buf))})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 call term_sendkeys(buf, "exit\r")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 exe buf . "bwipe!"
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 call delete('Xtext')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 func Test_terminal_shell_option()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 if has('unix')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 " exec is a shell builtin command, should fail without a shell.
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 term exec ls runtest.vim
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 call WaitForAssert({-> assert_match('job failed', term_getline(bufnr(), 1))})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 bwipe!
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 term ++shell exec ls runtest.vim
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 call WaitForAssert({-> assert_match('runtest.vim', term_getline(bufnr(), 1))})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 bwipe!
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 elseif has('win32')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 " dir is a shell builtin command, should fail without a shell.
21524
8c6433359913 patch 8.2.1312: MS-Windows: terminal test may fail if dir.exe exists
Bram Moolenaar <Bram@vim.org>
parents: 21427
diff changeset
46 " However, if dir.exe (which might be provided by Cygwin/MSYS2) exists in
8c6433359913 patch 8.2.1312: MS-Windows: terminal test may fail if dir.exe exists
Bram Moolenaar <Bram@vim.org>
parents: 21427
diff changeset
47 " the %PATH%, "term dir" succeeds unintentionally. Use dir.com instead.
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 try
21524
8c6433359913 patch 8.2.1312: MS-Windows: terminal test may fail if dir.exe exists
Bram Moolenaar <Bram@vim.org>
parents: 21427
diff changeset
49 term dir.com /b runtest.vim
8c6433359913 patch 8.2.1312: MS-Windows: terminal test may fail if dir.exe exists
Bram Moolenaar <Bram@vim.org>
parents: 21427
diff changeset
50 call WaitForAssert({-> assert_match('job failed', term_getline(bufnr(), 1))})
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 catch /CreateProcess/
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 " ignore
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 endtry
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 bwipe!
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55
21524
8c6433359913 patch 8.2.1312: MS-Windows: terminal test may fail if dir.exe exists
Bram Moolenaar <Bram@vim.org>
parents: 21427
diff changeset
56 " This should execute the dir builtin command even with ".com".
8c6433359913 patch 8.2.1312: MS-Windows: terminal test may fail if dir.exe exists
Bram Moolenaar <Bram@vim.org>
parents: 21427
diff changeset
57 term ++shell dir.com /b runtest.vim
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 call WaitForAssert({-> assert_match('runtest.vim', term_getline(bufnr(), 1))})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 bwipe!
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21524
diff changeset
60 else
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21524
diff changeset
61 throw 'Skipped: does not work on this platform'
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 endif
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 func Test_terminal_invalid_arg()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 call assert_fails('terminal ++xyz', 'E181:')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68
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
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
82 call writefile(lines, 'XtermStart')
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 call delete('XtermStart')
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
94 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
95
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
96 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
97 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
98 \ "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
99 \ ], "", [])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
100 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
101
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
102 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
103 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
104 \ "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
105 \ ], "term_highlight: 'MyTermCol',", [])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
106 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
107
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
108 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
109 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
110 \ "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
111 \ ], "", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
112 \ 'set wincolor=MyWinCol',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
113 \ ])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
114 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
115
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
116 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
117 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
118 \ "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
119 \ "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
120 \ ], "term_highlight: 'MyTermCol',", [])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
121 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
122
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
123 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
124 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
125 \ "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
126 \ "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
127 \ ], "term_highlight: 'MyTermCol',", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
128 \ 'set wincolor=MyWinCol',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
129 \ ])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
130 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
131
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
132 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
133 CheckRunVimInTerminal
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
134 CheckUnix
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
135
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
136 let lines = [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
137 \ '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
138 \ 'func OpenTerm()',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
139 \ ' set noruler',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
140 \ " 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
141 \ 'endfunc',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
142 \ '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
143 \ '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
144 \ '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
145 \ ]
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
146 call writefile(lines, 'XtermStart')
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
147 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
148 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
149 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
150 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
151 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
152 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
153
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>:split\<CR>")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
155 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
156 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
157
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>b:2sb\<CR>")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
159 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
160 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
161
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
162 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
163 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
164 call StopVimInTerminal(buf)
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
165 call delete('XtermStart')
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
166 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
167
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
168 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
169 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
170 \ "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
171 \ ], "", [])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
172 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
173
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
174 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
175 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
176 \ "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
177 \ ], "term_highlight: 'MyTermCol',", [])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
178 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
179
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
180 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
181 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
182 \ "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
183 \ ], "", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
184 \ 'set wincolor=MyWinCol',
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 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
187
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
188 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
189 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
190 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
191 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
192 \ "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
193 \ ], "", [])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
194 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
195
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
196 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
197 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
198 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
199 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
200 \ "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
201 \ ], "term_highlight: 'MyTermCol',", [])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
202 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
203
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
204 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
205 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
206 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
207 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
208 \ "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
209 \ ], "", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
210 \ 'set wincolor=MyWinCol',
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 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
213
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
214 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
215 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
216 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
217 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
218 \ "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
219 \ ], "", [])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
220 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
221
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
222 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
223 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
224 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
225 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
226 \ "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
227 \ ], "term_highlight: 'MyTermCol',", [])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
228 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
229
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
230 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
231 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
232 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
233 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
234 \ "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
235 \ ], "", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
236 \ 'set wincolor=MyWinCol',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
237 \ ])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
238 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
239
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
240 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
241 CheckRunVimInTerminal
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
242
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
243 let text =<< trim END
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
244 some text
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
245 to edit
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
246 in a popup window
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
247 END
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
248 call writefile(text, 'Xtext')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
249 let cmd = GetVimCommandCleanTerm()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
250 let lines = [
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
251 \ '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
252 \ 'hi PopTerm ctermbg=grey',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
253 \ 'func OpenTerm(setColor)',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
254 \ " set noruler",
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
255 \ " 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
256 \ ' 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
257 \ ' if a:setColor',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
258 \ ' 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
259 \ ' endif',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
260 \ 'endfunc',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
261 \ 'func HidePopup()',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
262 \ ' 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
263 \ 'endfunc',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
264 \ 'func ClosePopup()',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
265 \ ' 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
266 \ 'endfunc',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
267 \ 'func ReopenPopup()',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
268 \ ' 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
269 \ 'endfunc',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
270 \ ]
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
271 call writefile(lines, 'XtermPopup')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
272 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
273 call TermWait(buf, 100)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
274 call term_sendkeys(buf, ":call OpenTerm(0)\<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, ":\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
277 call TermWait(buf, 100)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
278 call term_sendkeys(buf, "\<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
279 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
280
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
281 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
282 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
283
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, ":call OpenTerm(1)\<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
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, ":set hlsearch\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
287 call TermWait(buf, 100)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
288 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
289 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
290
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, "\<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
292 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
293 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
294 call TermWait(buf, 50)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
295
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
296 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
297 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
298
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
299 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
300 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
301
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
302 " 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
303 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
304 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
305
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
306 " 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
307 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
308 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
309
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
310 call TermWait(buf, 50)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
311 call term_sendkeys(buf, ":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
312 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
313
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
314 call StopVimInTerminal(buf)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
315 call delete('Xtext')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
316 call delete('XtermPopup')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
317 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
318
23229
b545334ae654 patch 8.2.2160: various typos
Bram Moolenaar <Bram@vim.org>
parents: 22780
diff changeset
319 " 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
320 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
321 CheckRunVimInTerminal
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
322
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
323 let text =<< trim END
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
324 another text
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
325 to show
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
326 in a popup window
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
327 END
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
328 call writefile(text, 'Xtext')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
329 let lines = [
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
330 \ '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
331 \ 'func OpenTerm()',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
332 \ " 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
333 \ ' 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
334 \ 'endfunc',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
335 \ ]
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
336 call writefile(lines, 'XtermPopup')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
337 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
338 call TermWait(buf, 100)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
339 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
340 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
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, ":\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
343 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
344
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
345 call TermWait(buf, 50)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
346 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
347 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
348 call StopVimInTerminal(buf)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
349 call delete('Xtext')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
350 call delete('XtermPopup')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
351 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
352
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
353 " 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
354 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
355 CheckRunVimInTerminal
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
356 CheckUnix
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
357
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
358 let lines = [
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
359 \ '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
360 \ 'func OpenTerm()',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
361 \ " 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
362 \ .. 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
363 \ ' 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
364 \ .. a:popup_opt .. '})',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
365 \ ] + a:popup_cmds + [
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
366 \ 'endfunc',
26193
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
367 \ ] + a:highlight_cmds
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
368 call writefile(lines, 'XtermPopup')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
369 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
370 call TermWait(buf, 100)
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, ":set noruler\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
372 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
373 call TermWait(buf, 50)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
374 call term_sendkeys(buf, "hello\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
375 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
376
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
377 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
378 call TermWait(buf, 50)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
379 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
380 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
381 call StopVimInTerminal(buf)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
382 call delete('XtermPopup')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
383 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
384
26193
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
385 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
386 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
387 \ "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
388 \ ], "", [], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
389 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
390
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
391 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
392 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
393 \ "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
394 \ ], "term_highlight: 'MyTermCol',", [], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
395 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
396
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
397 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
398 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
399 \ "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
400 \ ], "", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
401 \ '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
402 \ ], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
403 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
404
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
405 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
406 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
407 \ "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
408 \ ], "", [], "highlight: 'MyPopupHlCol'")
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_group_over_Terminal()
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("MyTermCol_over_Terminal", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
413 \ "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
414 \ "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
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 endfunc
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 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
419 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
420 \ "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
421 \ "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
422 \ ], "term_highlight: 'MyTermCol',", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
423 \ '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
424 \ ], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
425 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
426
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
427 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
428 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
429 \ "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
430 \ ], "", [], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
431 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
432
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
433 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
434 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
435 \ "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
436 \ ], "term_highlight: 'MyTermCol',", [], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
437 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
438
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
439 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
440 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
441 \ "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
442 \ ], "", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
443 \ '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
444 \ ], "")
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
445 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
446
26193
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
447 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
448 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
449 \ "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
450 \ ], "", [], "highlight: 'MyPopupHlCol'")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
451 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
452
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
453 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
454 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
455 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
456 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
457 \ "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
458 \ ], "", [], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
459 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
460
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
461 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
462 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
463 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
464 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
465 \ "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
466 \ ], "term_highlight: 'MyTermCol',", [], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
467 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
468
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
469 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
470 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
471 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
472 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
473 \ "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
474 \ ], "", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
475 \ '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
476 \ ], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
477 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
478
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
479 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
480 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
481 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
482 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
483 \ "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
484 \ ], "", [], "highlight: 'MyPopupHlCol'")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
485 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
486
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
487 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
488 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
489 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
490 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
491 \ "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
492 \ ], "", [], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
493 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
494
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
495 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
496 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
497 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
498 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
499 \ "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
500 \ ], "term_highlight: 'MyTermCol',", [], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
501 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
502
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
503 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
504 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
505 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
506 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
507 \ "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
508 \ ], "", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
509 \ '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
510 \ ], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
511 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
512
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
513 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
514 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
515 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
516 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
517 \ "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
518 \ ], "", [], "highlight: 'MyPopupHlCol'")
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
519 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
520
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
521 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
522 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
523 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
524 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
525 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
526 call popup_close(win1)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
527 exe buf1 .. 'bwipe!'
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
528 exe buf2 .. 'bwipe!'
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
529 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
530
28580
39df510f97c3 patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents: 27120
diff changeset
531 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
532 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
533
39df510f97c3 patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents: 27120
diff changeset
534 " 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
535 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
536 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
537 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
538
39df510f97c3 patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents: 27120
diff changeset
539 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
540 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
541 endfunc
39df510f97c3 patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents: 27120
diff changeset
542
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
543 func Test_issue_5607()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
544 let wincount = winnr('$')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
545 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
546 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
547 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
548
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
549 let old_wincolor = &wincolor
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
550 try
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
551 set wincolor=
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
552 finally
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
553 let &wincolor = old_wincolor
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
554 bw!
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
555 endtry
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
556 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
557
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
558 func Test_hidden_terminal()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
559 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
560 call assert_equal('', bufname('^$'))
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
561 call StopShellInTerminal(buf)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
562 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
563
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
564 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
565 CheckExecutable sh
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
566
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
567 set hidden
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
568 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
569 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
570 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
571
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
572 call popup_clear(1)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
573 set hidden&
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
574 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
575
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
576 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
577 CheckRunVimInTerminal
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
578 CheckUnix
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
579
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
580 let lines =<< trim EOL
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
581 put='some text'
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
582 term
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
583 startinsert
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
584 EOL
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
585 call writefile(lines, 'XTest_startinsert')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
586 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
587
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
588 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
589 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
590 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
591 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
592 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
593
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
594 call StopVimInTerminal(buf)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
595 call delete('XTest_startinsert')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
596 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
597
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
598 " 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
599 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
600 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
601 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
602 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
603 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
604 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
605 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
606 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
607 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
608 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
609 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
610 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
611 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
612 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
613 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
614 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
615 endif
23984
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 23406
diff changeset
616 let buf = term_start('echo')
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 23406
diff changeset
617 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
618 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
619 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
620 exe buf . "bwipe!"
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
621 endfunc
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 " 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
624 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
625 CheckRunVimInTerminal
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
626
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
627 let buf = RunVimInTerminal('', {})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
628 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
629 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
630
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
631 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
632 \ "\<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
633 \ "\<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
634 \ "\<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
635 \ "\<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
636 \ "\<S-Down>"]
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
637 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
638 \ '<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
639 \ '<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
640 \ '<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
641 \ '<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
642
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
643 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
644 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
645 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
646 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
647 endfor
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
648
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
649 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
650 \ "\<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
651 \ "\<kMinus>", "\<kMultiply>", "\<kDivide>"]
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
652 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
653 \ '6', '7', '8', '9', '.', '+',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
654 \ '-', '*', '/']
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
655 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
656 " 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
657 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
658 continue
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
659 endif
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
660 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
661 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
662 endfor
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
663
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
664 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
665 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
666
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
667 call StopVimInTerminal(buf)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
668 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
669
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
670 " 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
671 func Test_term_mouse()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
672 CheckNotGui
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
673 CheckRunVimInTerminal
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
674
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
675 let save_mouse = &mouse
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
676 let save_term = &term
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
677 let save_ttymouse = &ttymouse
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
678 let save_clipboard = &clipboard
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
679 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
680
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
681 let lines =<< trim END
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
682 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
683 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
684 vim emacs sublime nano
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
685 END
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
686 call writefile(lines, 'Xtest_mouse')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
687
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
688 " 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
689 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
690 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
691 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
692 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
693 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
694 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
695 call TermWait(buf)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
696 redraw!
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
697
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
698 " 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
699 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
700 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
701 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
702 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
703
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
704 " 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
705 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
706 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
707 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
708 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
709 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
710 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
711 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
712 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
713 call assert_equal([3, 8], pos[1:2])
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
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 delete('Xbuf')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
717 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
718 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
719 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
720 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
721 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
722 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
723 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
724 call assert_equal('yellow', readfile('Xbuf')[0])
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
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 delete('Xbuf')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
728 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
729 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
730 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
731 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
732 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
733 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
734 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
735 call assert_equal('three four', readfile('Xbuf')[0])
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
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 delete('Xbuf')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
739 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
740 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
741 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
742 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
743 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
744 call assert_equal("vim emacs sublime nano\n", readfile('Xbuf')[0])
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
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 delete('Xbuf')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
748 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
749 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
750 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
751 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
752 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
753 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
754 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
755 call assert_equal("ree\nyel\nsub", readfile('Xbuf')[0])
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
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 delete('Xbuf')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
759 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
760 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
761 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
762 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
763 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
764 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
765 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
766 call assert_equal("n yellow", readfile('Xbuf')[0])
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
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 delete('Xbuf')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
770 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
771 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
772 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
773 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
774 call term_sendkeys(buf, ":call writefile([getline(2)], 'Xbuf')\<CR>")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
775 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
776 call assert_equal("red bright blue", readfile('Xbuf')[0][-15:])
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
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('Xtest_mouse')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
787 call delete('Xbuf')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
788 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
789
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
790 " 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
791 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
792 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
793 " 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
794 " 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
795 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
796
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 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
798 " , 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
799 " 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
800 " 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
801 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
802 " "," 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
803 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
804 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
805 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
806 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
807 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
808 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
809 "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
810 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
811 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
812 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
813 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
814 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
815 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
816 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
817
477b0a892a85 patch 8.2.2678: test for 'autoshelldir' does not reset the option
Bram Moolenaar <Bram@vim.org>
parents: 24268
diff changeset
818 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
819 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
820
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
821 " 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
822 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
823 CheckUnix
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
824 CheckNotGui
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
825 CheckRunVimInTerminal
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
826 CheckFeature clipboard_working
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
827
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
828 let save_mouse = &mouse
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
829 let save_term = &term
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
830 let save_ttymouse = &ttymouse
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
831 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
832 set clipboard=autoselectml
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
833
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
834 let lines =<< trim END
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
835 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
836 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
837 vim emacs sublime nano
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
838 END
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
839 call writefile(lines, 'Xtest_modeless')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
840
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
841 " 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
842 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
843 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
844 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
845 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
846 call TermWait(buf)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
847 redraw!
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
848
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
849 " 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
850 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
851 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
852 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
853 call TermWait(buf)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
854 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
855
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
856 " 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
857 let @* = 'clean'
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
858 " 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
859 sleep 100m
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
860 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
861 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
862 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
863 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
864
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
865 " cleanup
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
866 call TermWait(buf)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
867 call StopVimInTerminal(buf)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
868 let &mouse = save_mouse
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
869 let &term = save_term
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
870 let &ttymouse = save_ttymouse
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
871 set mousetime& clipboard&
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
872 call delete('Xtest_modeless')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
873 new | only!
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
874 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
875
21295
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
876 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
877 CheckRunVimInTerminal
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
878
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
879 " 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
880 split
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
881 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
882 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
883
21427
299cf1c2a37d patch 8.2.1264: terminal getwinpos() test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents: 21295
diff changeset
884 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
885 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
886 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
887
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
888 " 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
889 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
890 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
891 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
892 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
893 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
894
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
895 " 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
896 " 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
897 " 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
898 " 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
899 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
900 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
901 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
902 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
903 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
904 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
905 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
906 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
907 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
908
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 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
910 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
911 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
912 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
913 only!
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
914 endfunc
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
915
26608
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
916 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
917 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
918 try
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 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
920 catch
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
921 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
922 finally
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
923 "
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
924 endtry
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
925 endfunc
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
926 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
927
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
928 " 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
929 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
930 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
931
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
932 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
933 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
934 endfunc
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
935
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
936
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
937 " vim: shiftwidth=2 sts=2 expandtab