annotate src/testdir/test_cmdwin.vim @ 30588:56fabd53c7b8 v9.0.0629

patch 9.0.0629: get an error for using const only when executing Commit: https://github.com/vim/vim/commit/a5d1a67bee5672786c4b172f66ae4391e7b0cc57 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 30 17:57:47 2022 +0100 patch 9.0.0629: get an error for using const only when executing Problem: Get an error for using const only when executing. Solution: Check for const at compile time for filter(), map(), remove(), reverse(), sort() and uniq().
author Bram Moolenaar <Bram@vim.org>
date Fri, 30 Sep 2022 19:00:05 +0200
parents 6fa498af368d
children ac908e454519
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29369
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Tests for editing the command line.
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 source check.vim
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 CheckFeature cmdwin
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 source screendump.vim
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 func Test_getcmdwintype()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 call feedkeys("q/:let a = getcmdwintype()\<CR>:q\<CR>", 'x!')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 call assert_equal('/', a)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 call feedkeys("q?:let a = getcmdwintype()\<CR>:q\<CR>", 'x!')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 call assert_equal('?', a)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 call feedkeys("q::let a = getcmdwintype()\<CR>:q\<CR>", 'x!')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 call assert_equal(':', a)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 call feedkeys(":\<C-F>:let a = getcmdwintype()\<CR>:q\<CR>", 'x!')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 call assert_equal(':', a)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 call assert_equal('', getcmdwintype())
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 func Test_getcmdwin_autocmd()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 let s:seq = []
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 augroup CmdWin
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 au WinEnter * call add(s:seq, 'WinEnter ' .. win_getid())
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 au WinLeave * call add(s:seq, 'WinLeave ' .. win_getid())
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 au BufEnter * call add(s:seq, 'BufEnter ' .. bufnr())
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 au BufLeave * call add(s:seq, 'BufLeave ' .. bufnr())
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 au CmdWinEnter * call add(s:seq, 'CmdWinEnter ' .. win_getid())
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 au CmdWinLeave * call add(s:seq, 'CmdWinLeave ' .. win_getid())
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 let org_winid = win_getid()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 let org_bufnr = bufnr()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 call feedkeys("q::let a = getcmdwintype()\<CR>:let s:cmd_winid = win_getid()\<CR>:let s:cmd_bufnr = bufnr()\<CR>:q\<CR>", 'x!')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 call assert_equal(':', a)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 call assert_equal([
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 \ 'WinLeave ' .. org_winid,
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 \ 'WinEnter ' .. s:cmd_winid,
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 \ 'BufLeave ' .. org_bufnr,
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 \ 'BufEnter ' .. s:cmd_bufnr,
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 \ 'CmdWinEnter ' .. s:cmd_winid,
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 \ 'CmdWinLeave ' .. s:cmd_winid,
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 \ 'BufLeave ' .. s:cmd_bufnr,
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 \ 'WinLeave ' .. s:cmd_winid,
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 \ 'WinEnter ' .. org_winid,
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 \ 'BufEnter ' .. org_bufnr,
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 \ ], s:seq)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 au!
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 augroup END
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 func Test_cmdwin_bug()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 let winid = win_getid()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 sp
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 try
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 call feedkeys("q::call win_gotoid(" .. winid .. ")\<CR>:q\<CR>", 'x!')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 catch /^Vim\%((\a\+)\)\=:E11/
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 endtry
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 bw!
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 func Test_cmdwin_restore()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 CheckScreendump
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 let lines =<< trim [SCRIPT]
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 augroup vimHints | au! | augroup END
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 call setline(1, range(30))
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 2split
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 [SCRIPT]
30164
f7a2de8a4ddc patch 9.0.0418: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29820
diff changeset
73 call writefile(lines, 'XTest_restore', 'D')
29369
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 let buf = RunVimInTerminal('-S XTest_restore', {'rows': 12})
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 call term_sendkeys(buf, "q:")
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 call VerifyScreenDump(buf, 'Test_cmdwin_restore_1', {})
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 " normal restore
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 call term_sendkeys(buf, ":q\<CR>")
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 call VerifyScreenDump(buf, 'Test_cmdwin_restore_2', {})
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 " restore after setting 'lines' with one window
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 call term_sendkeys(buf, ":close\<CR>")
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 call term_sendkeys(buf, "q:")
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 call term_sendkeys(buf, ":set lines=18\<CR>")
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 call term_sendkeys(buf, ":q\<CR>")
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 call VerifyScreenDump(buf, 'Test_cmdwin_restore_3', {})
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90 " clean up
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 call StopVimInTerminal(buf)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 func Test_cmdwin_no_terminal()
30329
8496a2c45962 patch 9.0.0500: when quitting cmdline window with CTRL-C it remains visible
Bram Moolenaar <Bram@vim.org>
parents: 30312
diff changeset
95 CheckScreendump
29369
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 let buf = RunVimInTerminal('', {'rows': 12})
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 call term_sendkeys(buf, ":set cmdheight=2\<CR>")
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 call term_sendkeys(buf, "q:")
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100 call term_sendkeys(buf, ":let buf = term_start(['/bin/echo'], #{hidden: 1})\<CR>")
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101 call VerifyScreenDump(buf, 'Test_cmdwin_no_terminal', {})
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 call term_sendkeys(buf, ":q\<CR>")
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 call StopVimInTerminal(buf)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105
30329
8496a2c45962 patch 9.0.0500: when quitting cmdline window with CTRL-C it remains visible
Bram Moolenaar <Bram@vim.org>
parents: 30312
diff changeset
106 func Test_cmdwin_wrong_command()
8496a2c45962 patch 9.0.0500: when quitting cmdline window with CTRL-C it remains visible
Bram Moolenaar <Bram@vim.org>
parents: 30312
diff changeset
107 CheckScreendump
8496a2c45962 patch 9.0.0500: when quitting cmdline window with CTRL-C it remains visible
Bram Moolenaar <Bram@vim.org>
parents: 30312
diff changeset
108
8496a2c45962 patch 9.0.0500: when quitting cmdline window with CTRL-C it remains visible
Bram Moolenaar <Bram@vim.org>
parents: 30312
diff changeset
109 let buf = RunVimInTerminal('', {'rows': 12})
8496a2c45962 patch 9.0.0500: when quitting cmdline window with CTRL-C it remains visible
Bram Moolenaar <Bram@vim.org>
parents: 30312
diff changeset
110 call term_sendkeys(buf, "q:")
8496a2c45962 patch 9.0.0500: when quitting cmdline window with CTRL-C it remains visible
Bram Moolenaar <Bram@vim.org>
parents: 30312
diff changeset
111 call term_sendkeys(buf, "als\<Esc>")
8496a2c45962 patch 9.0.0500: when quitting cmdline window with CTRL-C it remains visible
Bram Moolenaar <Bram@vim.org>
parents: 30312
diff changeset
112 call term_sendkeys(buf, "\<C-W>k")
8496a2c45962 patch 9.0.0500: when quitting cmdline window with CTRL-C it remains visible
Bram Moolenaar <Bram@vim.org>
parents: 30312
diff changeset
113 call VerifyScreenDump(buf, 'Test_cmdwin_wrong_command_1', {})
8496a2c45962 patch 9.0.0500: when quitting cmdline window with CTRL-C it remains visible
Bram Moolenaar <Bram@vim.org>
parents: 30312
diff changeset
114
8496a2c45962 patch 9.0.0500: when quitting cmdline window with CTRL-C it remains visible
Bram Moolenaar <Bram@vim.org>
parents: 30312
diff changeset
115 call term_sendkeys(buf, "\<C-C>")
8496a2c45962 patch 9.0.0500: when quitting cmdline window with CTRL-C it remains visible
Bram Moolenaar <Bram@vim.org>
parents: 30312
diff changeset
116 call VerifyScreenDump(buf, 'Test_cmdwin_wrong_command_2', {})
8496a2c45962 patch 9.0.0500: when quitting cmdline window with CTRL-C it remains visible
Bram Moolenaar <Bram@vim.org>
parents: 30312
diff changeset
117
8496a2c45962 patch 9.0.0500: when quitting cmdline window with CTRL-C it remains visible
Bram Moolenaar <Bram@vim.org>
parents: 30312
diff changeset
118 call term_sendkeys(buf, ":q\<CR>")
8496a2c45962 patch 9.0.0500: when quitting cmdline window with CTRL-C it remains visible
Bram Moolenaar <Bram@vim.org>
parents: 30312
diff changeset
119 call StopVimInTerminal(buf)
8496a2c45962 patch 9.0.0500: when quitting cmdline window with CTRL-C it remains visible
Bram Moolenaar <Bram@vim.org>
parents: 30312
diff changeset
120 endfunc
8496a2c45962 patch 9.0.0500: when quitting cmdline window with CTRL-C it remains visible
Bram Moolenaar <Bram@vim.org>
parents: 30312
diff changeset
121
29369
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122 func Test_cmdwin_feedkeys()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
123 " This should not generate E488
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
124 call feedkeys("q:\<CR>", 'x')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 " Using feedkeys with q: only should automatically close the cmd window
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126 call feedkeys('q:', 'xt')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127 call assert_equal(1, winnr('$'))
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 call assert_equal('', getcmdwintype())
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 " Tests for the issues fixed in 7.4.441.
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132 " When 'cedit' is set to Ctrl-C, opening the command window hangs Vim
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
133 func Test_cmdwin_cedit()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134 exe "set cedit=\<C-c>"
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
135 normal! :
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136 call assert_equal(1, winnr('$'))
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
138 let g:cmd_wintype = ''
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139 func CmdWinType()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
140 let g:cmd_wintype = getcmdwintype()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
141 let g:wintype = win_gettype()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
142 return ''
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
144
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
145 call feedkeys("\<C-c>a\<C-R>=CmdWinType()\<CR>\<CR>")
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
146 echo input('')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
147 call assert_equal('@', g:cmd_wintype)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148 call assert_equal('command', g:wintype)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
149
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
150 set cedit&vim
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151 delfunc CmdWinType
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
152 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
153
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
154 " Test for CmdwinEnter autocmd
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155 func Test_cmdwin_autocmd()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
156 augroup CmdWin
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
157 au!
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
158 autocmd BufLeave * if &buftype == '' | update | endif
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
159 autocmd CmdwinEnter * startinsert
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
160 augroup END
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
161
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
162 call assert_fails('call feedkeys("q:xyz\<CR>", "xt")', 'E492:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
163 call assert_equal('xyz', @:)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
164
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
165 augroup CmdWin
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
166 au!
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
167 augroup END
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
168 augroup! CmdWin
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
169 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
170
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
171 func Test_cmdwin_jump_to_win()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
172 call assert_fails('call feedkeys("q:\<C-W>\<C-W>\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
173 new
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
174 set modified
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
175 call assert_fails('call feedkeys("q/:qall\<CR>", "xt")', ['E37:', 'E162:'])
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
176 close!
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
177 call feedkeys("q/:close\<CR>", "xt")
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
178 call assert_equal(1, winnr('$'))
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
179 call feedkeys("q/:exit\<CR>", "xt")
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
180 call assert_equal(1, winnr('$'))
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
181
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
182 " opening command window twice should fail
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
183 call assert_beeps('call feedkeys("q:q:\<CR>\<CR>", "xt")')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
184 call assert_equal(1, winnr('$'))
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
185 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
186
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
187 func Test_cmdwin_tabpage()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
188 tabedit
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
189 call assert_fails("silent norm q/g :I\<Esc>", 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
190 tabclose!
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
191 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
192
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
193 func Test_cmdwin_interrupted()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
194 CheckScreendump
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
195
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
196 " aborting the :smile output caused the cmdline window to use the current
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
197 " buffer.
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
198 let lines =<< trim [SCRIPT]
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
199 au WinNew * smile
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
200 [SCRIPT]
30164
f7a2de8a4ddc patch 9.0.0418: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29820
diff changeset
201 call writefile(lines, 'XTest_cmdwin', 'D')
29369
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
202
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
203 let buf = RunVimInTerminal('-S XTest_cmdwin', {'rows': 18})
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
204 " open cmdwin
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
205 call term_sendkeys(buf, "q:")
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
206 call WaitForAssert({-> assert_match('-- More --', term_getline(buf, 18))})
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
207 " quit more prompt for :smile command
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
208 call term_sendkeys(buf, "q")
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
209 call WaitForAssert({-> assert_match('^$', term_getline(buf, 18))})
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
210 " execute a simple command
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
211 call term_sendkeys(buf, "aecho 'done'\<CR>")
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
212 call VerifyScreenDump(buf, 'Test_cmdwin_interrupted', {})
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
213
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
214 " clean up
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
215 call StopVimInTerminal(buf)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
216 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
217
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
218 " Test for recursively getting multiple command line inputs
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
219 func Test_cmdwin_multi_input()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
220 call feedkeys(":\<C-R>=input('P: ')\<CR>\"cyan\<CR>\<CR>", 'xt')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
221 call assert_equal('"cyan', @:)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
222 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
223
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
224 " Test for normal mode commands not supported in the cmd window
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
225 func Test_cmdwin_blocked_commands()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
226 call assert_fails('call feedkeys("q:\<C-T>\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
227 call assert_fails('call feedkeys("q:\<C-]>\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
228 call assert_fails('call feedkeys("q:\<C-^>\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
229 call assert_fails('call feedkeys("q:Q\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
230 call assert_fails('call feedkeys("q:Z\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
231 call assert_fails('call feedkeys("q:\<F1>\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
232 call assert_fails('call feedkeys("q:\<C-W>s\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
233 call assert_fails('call feedkeys("q:\<C-W>v\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
234 call assert_fails('call feedkeys("q:\<C-W>^\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
235 call assert_fails('call feedkeys("q:\<C-W>n\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
236 call assert_fails('call feedkeys("q:\<C-W>z\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
237 call assert_fails('call feedkeys("q:\<C-W>o\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
238 call assert_fails('call feedkeys("q:\<C-W>w\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
239 call assert_fails('call feedkeys("q:\<C-W>j\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
240 call assert_fails('call feedkeys("q:\<C-W>k\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
241 call assert_fails('call feedkeys("q:\<C-W>h\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
242 call assert_fails('call feedkeys("q:\<C-W>l\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
243 call assert_fails('call feedkeys("q:\<C-W>T\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
244 call assert_fails('call feedkeys("q:\<C-W>x\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
245 call assert_fails('call feedkeys("q:\<C-W>r\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
246 call assert_fails('call feedkeys("q:\<C-W>R\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
247 call assert_fails('call feedkeys("q:\<C-W>K\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
248 call assert_fails('call feedkeys("q:\<C-W>}\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
249 call assert_fails('call feedkeys("q:\<C-W>]\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
250 call assert_fails('call feedkeys("q:\<C-W>f\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
251 call assert_fails('call feedkeys("q:\<C-W>d\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
252 call assert_fails('call feedkeys("q:\<C-W>g\<CR>", "xt")', 'E11:')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
253 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
254
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
255 " Close the Cmd-line window in insert mode using CTRL-C
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
256 func Test_cmdwin_insert_mode_close()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
257 %bw!
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
258 let s = ''
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
259 exe "normal q:a\<C-C>let s='Hello'\<CR>"
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
260 call assert_equal('Hello', s)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
261 call assert_equal(1, winnr('$'))
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
262 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
263
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
264 func Test_cmdwin_ex_mode_with_modifier()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
265 " this was accessing memory after allocated text in Ex mode
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
266 new
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
267 call setline(1, ['some', 'text', 'lines'])
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
268 silent! call feedkeys("gQnormal vq:atopleft\<C-V>\<CR>\<CR>", 'xt')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
269 bwipe!
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
270 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
271
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
272 func s:ComplInCmdwin_GlobalCompletion(a, l, p)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
273 return 'global'
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
274 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
275
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
276 func s:ComplInCmdwin_LocalCompletion(a, l, p)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
277 return 'local'
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
278 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
279
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
280 func Test_compl_in_cmdwin()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
281 set wildmenu wildchar=<Tab>
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
282 com! -nargs=1 -complete=command GetInput let input = <q-args>
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
283 com! -buffer TestCommand echo 'TestCommand'
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
284 let w:test_winvar = 'winvar'
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
285 let b:test_bufvar = 'bufvar'
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
286
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
287 " User-defined commands
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
288 let input = ''
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
289 call feedkeys("q:iGetInput T\<C-x>\<C-v>\<CR>", 'tx!')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
290 call assert_equal('TestCommand', input)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
291
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
292 let input = ''
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
293 call feedkeys("q::GetInput T\<Tab>\<CR>:q\<CR>", 'tx!')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
294 call assert_equal('T', input)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
295
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
296
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
297 com! -nargs=1 -complete=var GetInput let input = <q-args>
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
298 " Window-local variables
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
299 let input = ''
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
300 call feedkeys("q:iGetInput w:test_\<C-x>\<C-v>\<CR>", 'tx!')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
301 call assert_equal('w:test_winvar', input)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
302
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
303 let input = ''
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
304 call feedkeys("q::GetInput w:test_\<Tab>\<CR>:q\<CR>", 'tx!')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
305 call assert_equal('w:test_', input)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
306
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
307 " Buffer-local variables
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
308 let input = ''
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
309 call feedkeys("q:iGetInput b:test_\<C-x>\<C-v>\<CR>", 'tx!')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
310 call assert_equal('b:test_bufvar', input)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
311
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
312 let input = ''
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
313 call feedkeys("q::GetInput b:test_\<Tab>\<CR>:q\<CR>", 'tx!')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
314 call assert_equal('b:test_', input)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
315
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
316
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
317 " Argument completion of buffer-local command
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
318 func s:ComplInCmdwin_GlobalCompletionList(a, l, p)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
319 return ['global']
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
320 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
321
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
322 func s:ComplInCmdwin_LocalCompletionList(a, l, p)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
323 return ['local']
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
324 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
325
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
326 func s:ComplInCmdwin_CheckCompletion(arg)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
327 call assert_equal('local', a:arg)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
328 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
329
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
330 com! -nargs=1 -complete=custom,<SID>ComplInCmdwin_GlobalCompletion
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
331 \ TestCommand call s:ComplInCmdwin_CheckCompletion(<q-args>)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
332 com! -buffer -nargs=1 -complete=custom,<SID>ComplInCmdwin_LocalCompletion
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
333 \ TestCommand call s:ComplInCmdwin_CheckCompletion(<q-args>)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
334 call feedkeys("q:iTestCommand \<Tab>\<CR>", 'tx!')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
335
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
336 com! -nargs=1 -complete=customlist,<SID>ComplInCmdwin_GlobalCompletionList
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
337 \ TestCommand call s:ComplInCmdwin_CheckCompletion(<q-args>)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
338 com! -buffer -nargs=1 -complete=customlist,<SID>ComplInCmdwin_LocalCompletionList
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
339 \ TestCommand call s:ComplInCmdwin_CheckCompletion(<q-args>)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
340
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
341 call feedkeys("q:iTestCommand \<Tab>\<CR>", 'tx!')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
342
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
343 func! s:ComplInCmdwin_CheckCompletion(arg)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
344 call assert_equal('global', a:arg)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
345 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
346 new
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
347 call feedkeys("q:iTestCommand \<Tab>\<CR>", 'tx!')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
348 quit
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
349
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
350 delfunc s:ComplInCmdwin_GlobalCompletion
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
351 delfunc s:ComplInCmdwin_LocalCompletion
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
352 delfunc s:ComplInCmdwin_GlobalCompletionList
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
353 delfunc s:ComplInCmdwin_LocalCompletionList
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
354 delfunc s:ComplInCmdwin_CheckCompletion
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
355
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
356 delcom -buffer TestCommand
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
357 delcom TestCommand
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
358 delcom GetInput
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
359 unlet w:test_winvar
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
360 unlet b:test_bufvar
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
361 set wildmenu& wildchar&
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
362 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
363
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
364 func Test_cmdwin_ctrl_bsl()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
365 " Using CTRL-\ CTRL-N in cmd window should close the window
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
366 call feedkeys("q:\<C-\>\<C-N>", 'xt')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
367 call assert_equal('', getcmdwintype())
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
368 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
369
29444
44bb4a607125 patch 9.0.0064: confusing error when using "q:" in command line window
Bram Moolenaar <Bram@vim.org>
parents: 29369
diff changeset
370 func Test_cant_open_cmdwin_in_cmdwin()
44bb4a607125 patch 9.0.0064: confusing error when using "q:" in command line window
Bram Moolenaar <Bram@vim.org>
parents: 29369
diff changeset
371 try
44bb4a607125 patch 9.0.0064: confusing error when using "q:" in command line window
Bram Moolenaar <Bram@vim.org>
parents: 29369
diff changeset
372 call feedkeys("q:q::q\<CR>", "x!")
44bb4a607125 patch 9.0.0064: confusing error when using "q:" in command line window
Bram Moolenaar <Bram@vim.org>
parents: 29369
diff changeset
373 catch
44bb4a607125 patch 9.0.0064: confusing error when using "q:" in command line window
Bram Moolenaar <Bram@vim.org>
parents: 29369
diff changeset
374 let caught = v:exception
44bb4a607125 patch 9.0.0064: confusing error when using "q:" in command line window
Bram Moolenaar <Bram@vim.org>
parents: 29369
diff changeset
375 endtry
44bb4a607125 patch 9.0.0064: confusing error when using "q:" in command line window
Bram Moolenaar <Bram@vim.org>
parents: 29369
diff changeset
376 call assert_match('E1292:', caught)
44bb4a607125 patch 9.0.0064: confusing error when using "q:" in command line window
Bram Moolenaar <Bram@vim.org>
parents: 29369
diff changeset
377 endfunc
44bb4a607125 patch 9.0.0064: confusing error when using "q:" in command line window
Bram Moolenaar <Bram@vim.org>
parents: 29369
diff changeset
378
29757
beab53bb989e patch 9.0.0218: reading before the start of the line
Bram Moolenaar <Bram@vim.org>
parents: 29444
diff changeset
379 func Test_cmdwin_virtual_edit()
beab53bb989e patch 9.0.0218: reading before the start of the line
Bram Moolenaar <Bram@vim.org>
parents: 29444
diff changeset
380 enew!
beab53bb989e patch 9.0.0218: reading before the start of the line
Bram Moolenaar <Bram@vim.org>
parents: 29444
diff changeset
381 set ve=all cpo+=$
beab53bb989e patch 9.0.0218: reading before the start of the line
Bram Moolenaar <Bram@vim.org>
parents: 29444
diff changeset
382 silent normal q/s
beab53bb989e patch 9.0.0218: reading before the start of the line
Bram Moolenaar <Bram@vim.org>
parents: 29444
diff changeset
383
beab53bb989e patch 9.0.0218: reading before the start of the line
Bram Moolenaar <Bram@vim.org>
parents: 29444
diff changeset
384 set ve= cpo-=$
beab53bb989e patch 9.0.0218: reading before the start of the line
Bram Moolenaar <Bram@vim.org>
parents: 29444
diff changeset
385 endfunc
beab53bb989e patch 9.0.0218: reading before the start of the line
Bram Moolenaar <Bram@vim.org>
parents: 29444
diff changeset
386
29820
8629106c4982 patch 9.0.0249: no test for what 9.0.0234 fixes
Bram Moolenaar <Bram@vim.org>
parents: 29757
diff changeset
387 " Check that a :normal command can be used to stop Visual mode without side
8629106c4982 patch 9.0.0249: no test for what 9.0.0234 fixes
Bram Moolenaar <Bram@vim.org>
parents: 29757
diff changeset
388 " effects.
8629106c4982 patch 9.0.0249: no test for what 9.0.0234 fixes
Bram Moolenaar <Bram@vim.org>
parents: 29757
diff changeset
389 func Test_normal_escape()
8629106c4982 patch 9.0.0249: no test for what 9.0.0234 fixes
Bram Moolenaar <Bram@vim.org>
parents: 29757
diff changeset
390 call feedkeys("q:i\" foo\<Esc>:normal! \<C-V>\<Esc>\<CR>:\" bar\<CR>", 'ntx')
8629106c4982 patch 9.0.0249: no test for what 9.0.0234 fixes
Bram Moolenaar <Bram@vim.org>
parents: 29757
diff changeset
391 call assert_equal('" bar', @:)
8629106c4982 patch 9.0.0249: no test for what 9.0.0234 fixes
Bram Moolenaar <Bram@vim.org>
parents: 29757
diff changeset
392 endfunc
8629106c4982 patch 9.0.0249: no test for what 9.0.0234 fixes
Bram Moolenaar <Bram@vim.org>
parents: 29757
diff changeset
393
30308
6b541aaaf39e patch 9.0.0490: using freed memory with cmdwin and BufEnter autocmd
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
394 " This was using a pointer to a freed buffer
6b541aaaf39e patch 9.0.0490: using freed memory with cmdwin and BufEnter autocmd
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
395 func Test_cmdwin_freed_buffer_ptr()
30312
84ab2b07d5f8 patch 9.0.0492: cmdwin test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 30308
diff changeset
396 " this does not work on MS-Windows because renaming an open file fails
84ab2b07d5f8 patch 9.0.0492: cmdwin test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 30308
diff changeset
397 CheckNotMSWindows
84ab2b07d5f8 patch 9.0.0492: cmdwin test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 30308
diff changeset
398
30308
6b541aaaf39e patch 9.0.0490: using freed memory with cmdwin and BufEnter autocmd
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
399 au BufEnter * next 0| file
6b541aaaf39e patch 9.0.0490: using freed memory with cmdwin and BufEnter autocmd
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
400 edit 0
6b541aaaf39e patch 9.0.0490: using freed memory with cmdwin and BufEnter autocmd
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
401 silent! norm q/
6b541aaaf39e patch 9.0.0490: using freed memory with cmdwin and BufEnter autocmd
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
402
6b541aaaf39e patch 9.0.0490: using freed memory with cmdwin and BufEnter autocmd
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
403 au! BufEnter
6b541aaaf39e patch 9.0.0490: using freed memory with cmdwin and BufEnter autocmd
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
404 bwipe!
6b541aaaf39e patch 9.0.0490: using freed memory with cmdwin and BufEnter autocmd
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
405 endfunc
6b541aaaf39e patch 9.0.0490: using freed memory with cmdwin and BufEnter autocmd
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
406
30525
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
407 " This was resulting in a window with negative width.
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
408 " The test doesn't reproduce the illegal memory access though...
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
409 func Test_cmdwin_split_often()
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
410 let lines = &lines
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
411 let columns = &columns
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
412 set t_WS=
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
413
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
414 try
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
415 set encoding=iso8859
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
416 set ruler
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
417 winsize 0 0
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
418 noremap 0 H
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
419 sil norm 0000000q:
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
420 catch /E36:/
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
421 endtry
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
422
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
423 bwipe!
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
424 set encoding=utf8
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
425 let &lines = lines
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
426 let &columns = columns
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
427 endfunc
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
428
29369
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
429
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
430 " vim: shiftwidth=2 sts=2 expandtab