annotate src/testdir/test_cmdwin.vim @ 30763:8ea77a6ceff0 v9.0.0716

patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left Commit: https://github.com/vim/vim/commit/cd105417a53fcf97c0935f3468201ef11516c9f1 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Oct 10 19:50:42 2022 +0100 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left Problem: With 'nowrap' virtual text "after" does not scroll left. Solution: Skip part of the virtual text that is left of the window. (closes #11320) Fix going beyond the last column of the window.
author Bram Moolenaar <Bram@vim.org>
date Mon, 10 Oct 2022 21:00:05 +0200
parents ac908e454519
children bdbaaed04acd
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 source screendump.vim
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 func Test_getcmdwintype()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 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
8 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
9
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 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
11 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
12
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 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
14 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
15
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 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
17 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
18
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('', getcmdwintype())
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 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
23 let s:seq = []
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 augroup CmdWin
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 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
26 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
27 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
28 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
29 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
30 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
31
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 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
33 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
34 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
35 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
36 call assert_equal([
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 \ 'WinLeave ' .. org_winid,
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 \ '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
39 \ 'BufLeave ' .. org_bufnr,
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 \ '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
41 \ '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
42 \ '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
43 \ '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
44 \ '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
45 \ 'WinEnter ' .. org_winid,
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 \ 'BufEnter ' .. org_bufnr,
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 \ ], s:seq)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 au!
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 augroup END
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 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
54 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
55 sp
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 try
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 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
58 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
59 endtry
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 bw!
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 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
64 CheckScreendump
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 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
67 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
68 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
69 2split
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 [SCRIPT]
30164
f7a2de8a4ddc patch 9.0.0418: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29820
diff changeset
71 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
72
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 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
74 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
75 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
76
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 " normal restore
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 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
79 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
80
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 " 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
82 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
83 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
84 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
85 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
86 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
87
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 " clean up
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 call StopVimInTerminal(buf)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 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
93 CheckScreendump
29369
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 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
96 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
97 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
98 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
99 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
100 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
101 call StopVimInTerminal(buf)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103
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
104 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
105 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
106
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 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
108 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
109 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
110 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
111 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
112
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 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
114 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
115
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 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
117 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
118 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
119
29369
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 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
121 " 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
122 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
123 " 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
124 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
125 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
126 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
127 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129 " 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
130 " 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
131 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
132 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
133 normal! :
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134 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
135
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136 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
137 func CmdWinType()
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 = getcmdwintype()
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139 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
140 return ''
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
141 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
142
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143 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
144 echo input('')
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
145 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
146 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
147
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148 set cedit&vim
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
149 delfunc CmdWinType
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
150 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
152 " 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
153 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
154 augroup CmdWin
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155 au!
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
156 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
157 autocmd CmdwinEnter * startinsert
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
158 augroup END
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
159
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
160 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
161 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
162
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
163 augroup CmdWin
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
164 au!
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
165 augroup END
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
166 augroup! CmdWin
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
167 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
168
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
169 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
170 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
171 new
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
172 set modified
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
173 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
174 close!
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
175 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
176 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
177 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
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
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
180 " 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
181 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
182 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
183 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
184
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
185 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
186 tabedit
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
187 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
188 tabclose!
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
189 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
190
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
191 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
192 CheckScreendump
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
193
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
194 " 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
195 " buffer.
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
196 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
197 au WinNew * smile
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
198 [SCRIPT]
30164
f7a2de8a4ddc patch 9.0.0418: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29820
diff changeset
199 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
200
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
201 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
202 " open cmdwin
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
203 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
204 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
205 " 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
206 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
207 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
208 " 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
209 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
210 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
211
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
212 " clean up
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
213 call StopVimInTerminal(buf)
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
214 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
215
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
216 " 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
217 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
218 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
219 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
220 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
221
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
222 " 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
223 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
224 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
225 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
226 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
227 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
228 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
229 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
230 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
231 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
232 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
233 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
234 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
235 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
236 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
237 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
238 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
239 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
240 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
241 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
242 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
243 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
244 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
245 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
246 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
247 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
248 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
249 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
250 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
251 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
252
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
253 " 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
254 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
255 %bw!
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
256 let s = ''
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
257 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
258 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
259 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
260 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
261
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
262 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
263 " 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
264 new
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
265 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
266 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
267 bwipe!
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
268 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
269
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
270 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
271 return 'global'
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
272 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
273
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
274 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
275 return 'local'
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
276 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
277
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
278 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
279 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
280 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
281 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
282 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
283 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
284
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
285 " User-defined commands
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
286 let input = ''
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
287 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
288 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
289
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
290 let input = ''
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
291 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
292 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
293
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
294
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
295 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
296 " Window-local variables
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
297 let input = ''
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
298 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
299 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
300
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
301 let input = ''
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
302 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
303 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
304
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
305 " Buffer-local variables
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
306 let input = ''
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
307 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
308 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
309
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
310 let input = ''
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
311 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
312 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
313
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
314
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
315 " 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
316 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
317 return ['global']
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
318 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
319
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
320 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
321 return ['local']
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
322 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
323
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
324 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
325 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
326 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
327
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
328 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
329 \ 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
330 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
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 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
333
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
334 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
335 \ 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
336 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
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
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
339 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
340
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
341 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
342 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
343 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
344 new
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
345 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
346 quit
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
347
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
348 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
349 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
350 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
351 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
352 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
353
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
354 delcom -buffer TestCommand
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
355 delcom TestCommand
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
356 delcom GetInput
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
357 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
358 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
359 set wildmenu& wildchar&
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
360 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
361
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
362 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
363 " 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
364 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
365 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
366 endfunc
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
367
29444
44bb4a607125 patch 9.0.0064: confusing error when using "q:" in command line window
Bram Moolenaar <Bram@vim.org>
parents: 29369
diff changeset
368 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
369 try
44bb4a607125 patch 9.0.0064: confusing error when using "q:" in command line window
Bram Moolenaar <Bram@vim.org>
parents: 29369
diff changeset
370 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
371 catch
44bb4a607125 patch 9.0.0064: confusing error when using "q:" in command line window
Bram Moolenaar <Bram@vim.org>
parents: 29369
diff changeset
372 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
373 endtry
44bb4a607125 patch 9.0.0064: confusing error when using "q:" in command line window
Bram Moolenaar <Bram@vim.org>
parents: 29369
diff changeset
374 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
375 endfunc
44bb4a607125 patch 9.0.0064: confusing error when using "q:" in command line window
Bram Moolenaar <Bram@vim.org>
parents: 29369
diff changeset
376
29757
beab53bb989e patch 9.0.0218: reading before the start of the line
Bram Moolenaar <Bram@vim.org>
parents: 29444
diff changeset
377 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
378 enew!
beab53bb989e patch 9.0.0218: reading before the start of the line
Bram Moolenaar <Bram@vim.org>
parents: 29444
diff changeset
379 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
380 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
381
beab53bb989e patch 9.0.0218: reading before the start of the line
Bram Moolenaar <Bram@vim.org>
parents: 29444
diff changeset
382 set ve= cpo-=$
beab53bb989e patch 9.0.0218: reading before the start of the line
Bram Moolenaar <Bram@vim.org>
parents: 29444
diff changeset
383 endfunc
beab53bb989e patch 9.0.0218: reading before the start of the line
Bram Moolenaar <Bram@vim.org>
parents: 29444
diff changeset
384
29820
8629106c4982 patch 9.0.0249: no test for what 9.0.0234 fixes
Bram Moolenaar <Bram@vim.org>
parents: 29757
diff changeset
385 " 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
386 " effects.
8629106c4982 patch 9.0.0249: no test for what 9.0.0234 fixes
Bram Moolenaar <Bram@vim.org>
parents: 29757
diff changeset
387 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
388 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
389 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
390 endfunc
8629106c4982 patch 9.0.0249: no test for what 9.0.0234 fixes
Bram Moolenaar <Bram@vim.org>
parents: 29757
diff changeset
391
30308
6b541aaaf39e patch 9.0.0490: using freed memory with cmdwin and BufEnter autocmd
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
392 " 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
393 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
394 " 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
395 CheckNotMSWindows
84ab2b07d5f8 patch 9.0.0492: cmdwin test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 30308
diff changeset
396
30308
6b541aaaf39e patch 9.0.0490: using freed memory with cmdwin and BufEnter autocmd
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
397 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
398 edit 0
6b541aaaf39e patch 9.0.0490: using freed memory with cmdwin and BufEnter autocmd
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
399 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
400
6b541aaaf39e patch 9.0.0490: using freed memory with cmdwin and BufEnter autocmd
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
401 au! BufEnter
6b541aaaf39e patch 9.0.0490: using freed memory with cmdwin and BufEnter autocmd
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
402 bwipe!
6b541aaaf39e patch 9.0.0490: using freed memory with cmdwin and BufEnter autocmd
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
403 endfunc
6b541aaaf39e patch 9.0.0490: using freed memory with cmdwin and BufEnter autocmd
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
404
30525
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
405 " 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
406 " 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
407 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
408 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
409 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
410 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
411
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
412 try
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
413 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
414 set ruler
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
415 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
416 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
417 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
418 catch /E36:/
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
419 endtry
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
420
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
421 bwipe!
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
422 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
423 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
424 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
425 endfunc
6fa498af368d patch 9.0.0598: using negative array index with negative width window
Bram Moolenaar <Bram@vim.org>
parents: 30329
diff changeset
426
29369
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
427
b1f345ec827e patch 9.0.0027: the command line test is getting quite big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
428 " vim: shiftwidth=2 sts=2 expandtab