annotate src/testdir/test_prompt_buffer.vim @ 30334:945eb46e0773

Added tag v9.0.0502 for changeset fc0830246f49fda03876f76794a32fedc22d825b
author Bram Moolenaar <Bram@vim.org>
date Mon, 19 Sep 2022 17:00:08 +0200
parents b93e176e7998
children 457ea0570b6f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for setting 'buftype' to "prompt"
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
17089
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
3 source check.vim
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
4 CheckFeature channel
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 source shared.vim
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 source screendump.vim
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
9 func CanTestPromptBuffer()
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 " We need to use a terminal window to be able to feed keys without leaving
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 " Insert mode.
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
12 CheckFeature terminal
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
13
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
14 " TODO: make the tests work on MS-Windows
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
15 CheckNotMSWindows
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
16 endfunc
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
17
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
18 func WriteScript(name)
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 call writefile([
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 \ 'func TextEntered(text)',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 \ ' if a:text == "exit"',
14149
fba38a3491f5 patch 8.1.0092: prompt buffer test fails
Christian Brabandt <cb@256bit.org>
parents: 14029
diff changeset
22 \ ' " Reset &modified to allow the buffer to be closed.',
fba38a3491f5 patch 8.1.0092: prompt buffer test fails
Christian Brabandt <cb@256bit.org>
parents: 14029
diff changeset
23 \ ' set nomodified',
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 \ ' stopinsert',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 \ ' close',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 \ ' else',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 \ ' " Add the output above the current prompt.',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 \ ' call append(line("$") - 1, "Command: \"" . a:text . "\"")',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 \ ' " Reset &modified to allow the buffer to be closed.',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 \ ' set nomodified',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 \ ' call timer_start(20, {id -> TimerFunc(a:text)})',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 \ ' endif',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 \ 'endfunc',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 \ '',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 \ 'func TimerFunc(text)',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 \ ' " Add the output above the current prompt.',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 \ ' call append(line("$") - 1, "Result: \"" . a:text . "\"")',
14025
eb5ee7479d31 patch 8.1.0030: stoping Vim running in a terminal may not work
Christian Brabandt <cb@256bit.org>
parents: 14021
diff changeset
38 \ ' " Reset &modified to allow the buffer to be closed.',
eb5ee7479d31 patch 8.1.0030: stoping Vim running in a terminal may not work
Christian Brabandt <cb@256bit.org>
parents: 14021
diff changeset
39 \ ' set nomodified',
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 \ 'endfunc',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 \ '',
26280
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
42 \ 'func SwitchWindows()',
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
43 \ ' call timer_start(0, {-> execute("wincmd p|wincmd p", "")})',
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
44 \ 'endfunc',
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
45 \ '',
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 \ 'call setline(1, "other buffer")',
14025
eb5ee7479d31 patch 8.1.0030: stoping Vim running in a terminal may not work
Christian Brabandt <cb@256bit.org>
parents: 14021
diff changeset
47 \ 'set nomodified',
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 \ 'new',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 \ 'set buftype=prompt',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 \ 'call prompt_setcallback(bufnr(""), function("TextEntered"))',
17976
6d11a0d5751d patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
51 \ 'eval bufnr("")->prompt_setprompt("cmd: ")',
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 \ 'startinsert',
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
53 \ ], a:name)
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
54 endfunc
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
55
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
56 func Test_prompt_basic()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
57 call CanTestPromptBuffer()
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
58 let scriptName = 'XpromptscriptBasic'
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
59 call WriteScript(scriptName)
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
60
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
61 let buf = RunVimInTerminal('-S ' . scriptName, {})
17976
6d11a0d5751d patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
62 call WaitForAssert({-> assert_equal('cmd:', term_getline(buf, 1))})
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 call term_sendkeys(buf, "hello\<CR>")
17976
6d11a0d5751d patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
65 call WaitForAssert({-> assert_equal('cmd: hello', term_getline(buf, 1))})
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 call WaitForAssert({-> assert_equal('Command: "hello"', term_getline(buf, 2))})
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 call WaitForAssert({-> assert_equal('Result: "hello"', term_getline(buf, 3))})
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 call term_sendkeys(buf, "exit\<CR>")
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 call WaitForAssert({-> assert_equal('other buffer', term_getline(buf, 1))})
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 call StopVimInTerminal(buf)
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
73 call delete(scriptName)
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 endfunc
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
75
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
76 func Test_prompt_editing()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
77 call CanTestPromptBuffer()
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
78 let scriptName = 'XpromptscriptEditing'
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
79 call WriteScript(scriptName)
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
80
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
81 let buf = RunVimInTerminal('-S ' . scriptName, {})
17976
6d11a0d5751d patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
82 call WaitForAssert({-> assert_equal('cmd:', term_getline(buf, 1))})
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
83
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
84 let bs = "\<BS>"
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
85 call term_sendkeys(buf, "hello" . bs . bs)
17976
6d11a0d5751d patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
86 call WaitForAssert({-> assert_equal('cmd: hel', term_getline(buf, 1))})
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
87
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
88 let left = "\<Left>"
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
89 call term_sendkeys(buf, left . left . left . bs . '-')
17976
6d11a0d5751d patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
90 call WaitForAssert({-> assert_equal('cmd: -hel', term_getline(buf, 1))})
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
91
22934
3f04c2cf0ced patch 8.2.2014: using CTRL-O in a prompt buffer moves cursor to start
Bram Moolenaar <Bram@vim.org>
parents: 22858
diff changeset
92 call term_sendkeys(buf, "\<C-O>lz")
3f04c2cf0ced patch 8.2.2014: using CTRL-O in a prompt buffer moves cursor to start
Bram Moolenaar <Bram@vim.org>
parents: 22858
diff changeset
93 call WaitForAssert({-> assert_equal('cmd: -hzel', term_getline(buf, 1))})
3f04c2cf0ced patch 8.2.2014: using CTRL-O in a prompt buffer moves cursor to start
Bram Moolenaar <Bram@vim.org>
parents: 22858
diff changeset
94
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
95 let end = "\<End>"
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
96 call term_sendkeys(buf, end . "x")
22934
3f04c2cf0ced patch 8.2.2014: using CTRL-O in a prompt buffer moves cursor to start
Bram Moolenaar <Bram@vim.org>
parents: 22858
diff changeset
97 call WaitForAssert({-> assert_equal('cmd: -hzelx', term_getline(buf, 1))})
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
98
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
99 call term_sendkeys(buf, "\<C-U>exit\<CR>")
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
100 call WaitForAssert({-> assert_equal('other buffer', term_getline(buf, 1))})
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
101
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
102 call StopVimInTerminal(buf)
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
103 call delete(scriptName)
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
104 endfunc
17151
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
105
26280
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
106 func Test_prompt_switch_windows()
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
107 call CanTestPromptBuffer()
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
108 let scriptName = 'XpromptSwitchWindows'
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
109 call WriteScript(scriptName)
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
110
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
111 let buf = RunVimInTerminal('-S ' . scriptName, {'rows': 12})
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
112 call WaitForAssert({-> assert_equal('cmd:', term_getline(buf, 1))})
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
113 call WaitForAssert({-> assert_match('-- INSERT --', term_getline(buf, 12))})
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
114
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
115 call term_sendkeys(buf, "\<C-O>:call SwitchWindows()\<CR>")
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
116 call term_wait(buf, 50)
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
117 call WaitForAssert({-> assert_match('-- INSERT --', term_getline(buf, 12))})
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
118
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
119 call term_sendkeys(buf, "\<Esc>")
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
120 call term_wait(buf, 50)
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
121 call WaitForAssert({-> assert_match('^ *$', term_getline(buf, 12))})
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
122
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
123 call StopVimInTerminal(buf)
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
124 call delete(scriptName)
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
125 endfunc
b93e176e7998 patch 8.2.3671: restarting Insert mode in prompt buffer too often
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
126
17151
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
127 func Test_prompt_garbage_collect()
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
128 func MyPromptCallback(x, text)
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
129 " NOP
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
130 endfunc
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
131 func MyPromptInterrupt(x)
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
132 " NOP
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
133 endfunc
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
134
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
135 new
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
136 set buftype=prompt
17976
6d11a0d5751d patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
137 eval bufnr('')->prompt_setcallback(function('MyPromptCallback', [{}]))
6d11a0d5751d patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
138 eval bufnr('')->prompt_setinterrupt(function('MyPromptInterrupt', [{}]))
17151
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
139 call test_garbagecollect_now()
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
140 " Must not crash
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
141 call feedkeys("\<CR>\<C-C>", 'xt')
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
142 call assert_true(v:true)
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
143
19852
12518b40c161 patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
144 call assert_fails("call prompt_setcallback(bufnr(), [])", 'E921:')
12518b40c161 patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
145 call assert_equal(0, prompt_setcallback({}, ''))
12518b40c161 patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
146 call assert_fails("call prompt_setinterrupt(bufnr(), [])", 'E921:')
12518b40c161 patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
147 call assert_equal(0, prompt_setinterrupt({}, ''))
12518b40c161 patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
148
17151
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
149 delfunc MyPromptCallback
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
150 bwipe!
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
151 endfunc
19613
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
152
22858
52b5aa2e8c8f patch 8.2.1976: cannot backspace in prompt buffer after using cursor-left
Bram Moolenaar <Bram@vim.org>
parents: 22466
diff changeset
153 func Test_prompt_backspace()
52b5aa2e8c8f patch 8.2.1976: cannot backspace in prompt buffer after using cursor-left
Bram Moolenaar <Bram@vim.org>
parents: 22466
diff changeset
154 new
52b5aa2e8c8f patch 8.2.1976: cannot backspace in prompt buffer after using cursor-left
Bram Moolenaar <Bram@vim.org>
parents: 22466
diff changeset
155 set buftype=prompt
52b5aa2e8c8f patch 8.2.1976: cannot backspace in prompt buffer after using cursor-left
Bram Moolenaar <Bram@vim.org>
parents: 22466
diff changeset
156 call feedkeys("A123456\<Left>\<BS>\<Esc>", 'xt')
52b5aa2e8c8f patch 8.2.1976: cannot backspace in prompt buffer after using cursor-left
Bram Moolenaar <Bram@vim.org>
parents: 22466
diff changeset
157 call assert_equal('% 12346', getline(1))
52b5aa2e8c8f patch 8.2.1976: cannot backspace in prompt buffer after using cursor-left
Bram Moolenaar <Bram@vim.org>
parents: 22466
diff changeset
158 bwipe!
52b5aa2e8c8f patch 8.2.1976: cannot backspace in prompt buffer after using cursor-left
Bram Moolenaar <Bram@vim.org>
parents: 22466
diff changeset
159 endfunc
52b5aa2e8c8f patch 8.2.1976: cannot backspace in prompt buffer after using cursor-left
Bram Moolenaar <Bram@vim.org>
parents: 22466
diff changeset
160
19613
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
161 " Test for editing the prompt buffer
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
162 func Test_prompt_buffer_edit()
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
163 new
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
164 set buftype=prompt
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
165 normal! i
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
166 call assert_beeps('normal! dd')
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
167 call assert_beeps('normal! ~')
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
168 call assert_beeps('normal! o')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
169 call assert_beeps('normal! O')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
170 call assert_beeps('normal! p')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
171 call assert_beeps('normal! P')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
172 call assert_beeps('normal! u')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
173 call assert_beeps('normal! ra')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
174 call assert_beeps('normal! s')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
175 call assert_beeps('normal! S')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
176 call assert_beeps("normal! \<C-A>")
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
177 call assert_beeps("normal! \<C-X>")
24870
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 22934
diff changeset
178 call assert_beeps("normal! dp")
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 22934
diff changeset
179 call assert_beeps("normal! do")
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20120
diff changeset
180 " pressing CTRL-W in the prompt buffer should trigger the window commands
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20120
diff changeset
181 call assert_equal(1, winnr())
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20120
diff changeset
182 exe "normal A\<C-W>\<C-W>"
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20120
diff changeset
183 call assert_equal(2, winnr())
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20120
diff changeset
184 wincmd w
19613
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
185 close!
20120
16460964c304 patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents: 19852
diff changeset
186 call assert_equal(0, prompt_setprompt([], ''))
19613
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
187 endfunc
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
188
22077
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
189 func Test_prompt_buffer_getbufinfo()
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
190 new
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
191 call assert_equal('', prompt_getprompt('%'))
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
192 call assert_equal('', prompt_getprompt(bufnr('%')))
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
193 let another_buffer = bufnr('%')
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
194
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
195 set buftype=prompt
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
196 call assert_equal('% ', prompt_getprompt('%'))
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
197 call prompt_setprompt( bufnr( '%' ), 'This is a test: ' )
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
198 call assert_equal('This is a test: ', prompt_getprompt('%'))
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
199
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
200 call prompt_setprompt( bufnr( '%' ), '' )
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
201 call assert_equal('', '%'->prompt_getprompt())
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
202
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
203 call prompt_setprompt( bufnr( '%' ), 'Another: ' )
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
204 call assert_equal('Another: ', prompt_getprompt('%'))
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
205 let another = bufnr('%')
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
206
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
207 new
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
208
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
209 call assert_equal('', prompt_getprompt('%'))
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
210 call assert_equal('Another: ', prompt_getprompt(another))
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
211
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
212 " Doesn't exist
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
213 let buffers_before = len( getbufinfo() )
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
214 call assert_equal('', prompt_getprompt( bufnr('$') + 1))
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
215 call assert_equal(buffers_before, len( getbufinfo()))
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
216
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
217 " invalid type
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
218 call assert_fails('call prompt_getprompt({})', 'E728:')
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
219
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
220 %bwipe!
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
221 endfunc
335365fcbb60 patch 8.2.1588: cannot read back the prompt of a prompt buffer
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
222
22466
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
223 function! Test_prompt_while_writing_to_hidden_buffer()
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
224 call CanTestPromptBuffer()
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
225 CheckUnix
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
226
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
227 " Make a job continuously write to a hidden buffer, check that the prompt
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
228 " buffer is not affected.
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
229 let scriptName = 'XpromptscriptHiddenBuf'
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
230 let script =<< trim END
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
231 set buftype=prompt
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
232 call prompt_setprompt( bufnr(), 'cmd:' )
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
233 let job = job_start(['/bin/sh', '-c',
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
234 \ 'while true;
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
235 \ do echo line;
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
236 \ sleep 0.1;
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
237 \ done'], #{out_io: 'buffer', out_name: ''})
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
238 startinsert
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
239 END
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
240 eval script->writefile(scriptName)
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
241
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
242 let buf = RunVimInTerminal('-S ' .. scriptName, {})
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
243 call WaitForAssert({-> assert_equal('cmd:', term_getline(buf, 1))})
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
244
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
245 call term_sendkeys(buf, 'test')
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
246 call WaitForAssert({-> assert_equal('cmd:test', term_getline(buf, 1))})
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
247 call term_sendkeys(buf, 'test')
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
248 call WaitForAssert({-> assert_equal('cmd:testtest', term_getline(buf, 1))})
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
249 call term_sendkeys(buf, 'test')
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
250 call WaitForAssert({-> assert_equal('cmd:testtesttest', term_getline(buf, 1))})
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
251
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
252 call StopVimInTerminal(buf)
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
253 call delete(scriptName)
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
254 endfunc
18f400b24f5f patch 8.2.1781: writing to prompt buffer interferes with insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22077
diff changeset
255
19613
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
256 " vim: shiftwidth=2 sts=2 expandtab