annotate src/testdir/test_terminal3.vim @ 28459:52ef65c0637f v8.2.4754

patch 8.2.4754: using cached values after unsetting some environment variables Commit: https://github.com/vim/vim/commit/7714231bb5b15f7c85453f3945c108478de1d08a Author: LemonBoy <thatlemon@gmail.com> Date: Fri Apr 15 20:50:46 2022 +0100 patch 8.2.4754: using cached values after unsetting some environment variables Problem: Still using cached values after unsetting some known environment variables. Solution: Take care of the side effects. (closes #10194)
author Bram Moolenaar <Bram@vim.org>
date Fri, 15 Apr 2022 22:00:03 +0200
parents 2961745336b8
children 39df510f97c3
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
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
531 func Test_issue_5607()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
532 let wincount = winnr('$')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
533 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
534 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
535 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
536
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
537 let old_wincolor = &wincolor
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
538 try
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
539 set wincolor=
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
540 finally
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
541 let &wincolor = old_wincolor
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
542 bw!
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
543 endtry
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
544 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
545
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
546 func Test_hidden_terminal()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
547 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
548 call assert_equal('', bufname('^$'))
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
549 call StopShellInTerminal(buf)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
550 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
551
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
552 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
553 CheckExecutable sh
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
554
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
555 set hidden
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
556 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
557 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
558 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
559
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
560 call popup_clear(1)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
561 set hidden&
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_and_startinsert()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
565 CheckRunVimInTerminal
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
566 CheckUnix
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
567
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
568 let lines =<< trim EOL
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
569 put='some text'
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
570 term
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
571 startinsert
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
572 EOL
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
573 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
574 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
575
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
576 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
577 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
578 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
579 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
580 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
581
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
582 call StopVimInTerminal(buf)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
583 call delete('XTest_startinsert')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
584 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
585
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
586 " 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
587 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
588 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
589 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
590 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
591 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
592 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
593 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
594 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
595 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
596 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
597 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
598 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
599 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
600 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
601 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
602 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
603 endif
23984
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 23406
diff changeset
604 let buf = term_start('echo')
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 23406
diff changeset
605 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
606 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
607 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
608 exe buf . "bwipe!"
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
609 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
610
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
611 " 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
612 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
613 CheckRunVimInTerminal
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
614
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
615 let buf = RunVimInTerminal('', {})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
616 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
617 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
618
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
619 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
620 \ "\<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
621 \ "\<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
622 \ "\<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
623 \ "\<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
624 \ "\<S-Down>"]
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
625 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
626 \ '<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
627 \ '<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
628 \ '<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
629 \ '<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
630
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
631 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
632 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
633 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
634 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
635 endfor
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
636
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
637 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
638 \ "\<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
639 \ "\<kMinus>", "\<kMultiply>", "\<kDivide>"]
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
640 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
641 \ '6', '7', '8', '9', '.', '+',
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 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
644 " 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
645 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
646 continue
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
647 endif
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
648 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
649 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
650 endfor
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
651
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
652 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
653 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
654
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
655 call StopVimInTerminal(buf)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
656 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
657
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
658 " 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
659 func Test_term_mouse()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
660 CheckNotGui
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
661 CheckRunVimInTerminal
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
662
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
663 let save_mouse = &mouse
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
664 let save_term = &term
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
665 let save_ttymouse = &ttymouse
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
666 let save_clipboard = &clipboard
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
667 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
668
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
669 let lines =<< trim END
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
670 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
671 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
672 vim emacs sublime nano
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
673 END
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
674 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
675
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
676 " 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
677 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
678 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
679 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
680 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
681 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
682 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
683 call TermWait(buf)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
684 redraw!
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
685
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
686 " 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
687 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
688 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
689 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
690 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
691
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
692 " 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
693 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
694 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
695 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
696 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
697 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
698 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
699 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
700 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
701 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
702
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
703 " 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
704 call delete('Xbuf')
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, 11)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
706 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
707 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
708 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
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([@\"], '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 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
713
26193
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
714 " 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
715 call delete('Xbuf')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
716 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
717 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
718 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
719 call term_sendkeys(buf, "\<LeftRelease>y")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
720 call TermWait(buf, 50)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
721 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
722 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
723 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
724
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
725 " 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
726 call delete('Xbuf')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
727 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
728 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
729 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
730 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
731 call TermWait(buf, 50)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
732 call 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
733
26193
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
734 " 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
735 call delete('Xbuf')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
736 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
737 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
738 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
739 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
740 call TermWait(buf, 50)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
741 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
742 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
743 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
744
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
745 " 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
746 call delete('Xbuf')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
747 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
748 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
749 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
750 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
751 call TermWait(buf, 50)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
752 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
753 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
754 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
755
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
756 " 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
757 call delete('Xbuf')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
758 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
759 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
760 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
761 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
762 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
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 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
765
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
766 " cleanup
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
767 call TermWait(buf)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
768 call StopVimInTerminal(buf)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
769 let &mouse = save_mouse
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
770 let &term = save_term
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
771 let &ttymouse = save_ttymouse
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
772 let &clipboard = save_clipboard
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
773 set mousetime&
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
774 call delete('Xtest_mouse')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
775 call delete('Xbuf')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
776 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
777
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
778 " 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
779 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
780 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
781 " 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
782 " 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
783 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
784
9257f3980f4a patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents: 23984
diff changeset
785 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
786 " , 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
787 " 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
788 " 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
789 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
790 " "," 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
791 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
792 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
793 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
794 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
795 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
796 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
797 "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
798 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
799 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
800 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
801 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
802 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
803 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
804 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
805
477b0a892a85 patch 8.2.2678: test for 'autoshelldir' does not reset the option
Bram Moolenaar <Bram@vim.org>
parents: 24268
diff changeset
806 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
807 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
808
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
809 " 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
810 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
811 CheckUnix
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
812 CheckNotGui
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
813 CheckRunVimInTerminal
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
814 CheckFeature clipboard_working
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
815
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
816 let save_mouse = &mouse
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
817 let save_term = &term
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
818 let save_ttymouse = &ttymouse
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
819 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
820 set clipboard=autoselectml
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
821
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
822 let lines =<< trim END
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
823 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
824 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
825 vim emacs sublime nano
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
826 END
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
827 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
828
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
829 " 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
830 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
831 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
832 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
833 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
834 call TermWait(buf)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
835 redraw!
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
836
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
837 " 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
838 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
839 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
840 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
841 call TermWait(buf)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
842 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
843
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
844 " 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
845 let @* = 'clean'
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
846 " 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
847 sleep 100m
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
848 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
849 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
850 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
851 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
852
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
853 " cleanup
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
854 call TermWait(buf)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
855 call StopVimInTerminal(buf)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
856 let &mouse = save_mouse
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
857 let &term = save_term
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
858 let &ttymouse = save_ttymouse
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
859 set mousetime& clipboard&
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
860 call delete('Xtest_modeless')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
861 new | only!
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
862 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
863
21295
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
864 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
865 CheckRunVimInTerminal
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
866
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
867 " 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
868 split
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
869 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
870 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
871
21427
299cf1c2a37d patch 8.2.1264: terminal getwinpos() test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents: 21295
diff changeset
872 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
873 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
874 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
875
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
876 " 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
877 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
878 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
879 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
880 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
881 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
882
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
883 " 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
884 " 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
885 " 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
886 " 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
887 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
888 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
889 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
890 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
891 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
892 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
893 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
894 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
895 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
896
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
897 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
898 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
899 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
900 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
901 only!
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
902 endfunc
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
903
26608
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
904 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
905 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
906 try
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
907 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
908 catch
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
909 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
910 finally
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
911 "
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
912 endtry
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
913 endfunc
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
914 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
915
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
916 " 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
917 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
918 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
919
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
920 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
921 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
922 endfunc
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
923
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
924
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
925 " vim: shiftwidth=2 sts=2 expandtab