To: vim_dev@googlegroups.com Subject: Patch 9.0.0027 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0027 Problem: The command line test is getting quite big. Solution: Move command line window tests to a separate file. Files: src/testdir/test_cmdline.vim, src/testdir/test_cmdwin.vim, src/testdir/Make_all.mak, src/testdir/test_ins_complete.vim, src/testdir/test_normal.vim *** ../vim-9.0.0026/src/testdir/test_cmdline.vim 2022-07-02 13:43:17.947746835 +0100 --- src/testdir/test_cmdline.vim 2022-07-02 16:09:03.988743200 +0100 *************** *** 1322,1378 **** call assert_equal('', getcmdline()) endfunc - func Test_getcmdwintype() - CheckFeature cmdwin - - call feedkeys("q/:let a = getcmdwintype()\:q\", 'x!') - call assert_equal('/', a) - - call feedkeys("q?:let a = getcmdwintype()\:q\", 'x!') - call assert_equal('?', a) - - call feedkeys("q::let a = getcmdwintype()\:q\", 'x!') - call assert_equal(':', a) - - call feedkeys(":\:let a = getcmdwintype()\:q\", 'x!') - call assert_equal(':', a) - - call assert_equal('', getcmdwintype()) - endfunc - - func Test_getcmdwin_autocmd() - CheckFeature cmdwin - - let s:seq = [] - augroup CmdWin - au WinEnter * call add(s:seq, 'WinEnter ' .. win_getid()) - au WinLeave * call add(s:seq, 'WinLeave ' .. win_getid()) - au BufEnter * call add(s:seq, 'BufEnter ' .. bufnr()) - au BufLeave * call add(s:seq, 'BufLeave ' .. bufnr()) - au CmdWinEnter * call add(s:seq, 'CmdWinEnter ' .. win_getid()) - au CmdWinLeave * call add(s:seq, 'CmdWinLeave ' .. win_getid()) - - let org_winid = win_getid() - let org_bufnr = bufnr() - call feedkeys("q::let a = getcmdwintype()\:let s:cmd_winid = win_getid()\:let s:cmd_bufnr = bufnr()\:q\", 'x!') - call assert_equal(':', a) - call assert_equal([ - \ 'WinLeave ' .. org_winid, - \ 'WinEnter ' .. s:cmd_winid, - \ 'BufLeave ' .. org_bufnr, - \ 'BufEnter ' .. s:cmd_bufnr, - \ 'CmdWinEnter ' .. s:cmd_winid, - \ 'CmdWinLeave ' .. s:cmd_winid, - \ 'BufLeave ' .. s:cmd_bufnr, - \ 'WinLeave ' .. s:cmd_winid, - \ 'WinEnter ' .. org_winid, - \ 'BufEnter ' .. org_bufnr, - \ ], s:seq) - - au! - augroup END - endfunc - func Test_verbosefile() set verbosefile=Xlog echomsg 'foo' --- 1322,1327 ---- *************** *** 1454,1518 **** let &encoding = encoding_save endfunc - func Test_cmdwin_bug() - CheckFeature cmdwin - - let winid = win_getid() - sp - try - call feedkeys("q::call win_gotoid(" .. winid .. ")\:q\", 'x!') - catch /^Vim\%((\a\+)\)\=:E11/ - endtry - bw! - endfunc - - func Test_cmdwin_restore() - CheckFeature cmdwin - CheckScreendump - - let lines =<< trim [SCRIPT] - augroup vimHints | au! | augroup END - call setline(1, range(30)) - 2split - [SCRIPT] - call writefile(lines, 'XTest_restore') - - let buf = RunVimInTerminal('-S XTest_restore', {'rows': 12}) - call TermWait(buf, 50) - call term_sendkeys(buf, "q:") - call VerifyScreenDump(buf, 'Test_cmdwin_restore_1', {}) - - " normal restore - call term_sendkeys(buf, ":q\") - call VerifyScreenDump(buf, 'Test_cmdwin_restore_2', {}) - - " restore after setting 'lines' with one window - call term_sendkeys(buf, ":close\") - call term_sendkeys(buf, "q:") - call term_sendkeys(buf, ":set lines=18\") - call term_sendkeys(buf, ":q\") - call VerifyScreenDump(buf, 'Test_cmdwin_restore_3', {}) - - " clean up - call StopVimInTerminal(buf) - call delete('XTest_restore') - endfunc - - func Test_cmdwin_no_terminal() - CheckFeature cmdwin - CheckFeature terminal - CheckNotMSWindows - - let buf = RunVimInTerminal('', {'rows': 12}) - call TermWait(buf, 50) - call term_sendkeys(buf, ":set cmdheight=2\") - call term_sendkeys(buf, "q:") - call term_sendkeys(buf, ":let buf = term_start(['/bin/echo'], #{hidden: 1})\") - call VerifyScreenDump(buf, 'Test_cmdwin_no_terminal', {}) - call term_sendkeys(buf, ":q\") - call StopVimInTerminal(buf) - endfunc - func Test_buffers_lastused() " check that buffers are sorted by time when wildmode has lastused call test_settime(1550020000) " middle --- 1403,1408 ---- *************** *** 1558,1618 **** bwipeout bufc endfunc - func Test_cmdwin_feedkeys() - CheckFeature cmdwin - - " This should not generate E488 - call feedkeys("q:\", 'x') - " Using feedkeys with q: only should automatically close the cmd window - call feedkeys('q:', 'xt') - call assert_equal(1, winnr('$')) - call assert_equal('', getcmdwintype()) - endfunc - - " Tests for the issues fixed in 7.4.441. - " When 'cedit' is set to Ctrl-C, opening the command window hangs Vim - func Test_cmdwin_cedit() - CheckFeature cmdwin - - exe "set cedit=\" - normal! : - call assert_equal(1, winnr('$')) - - let g:cmd_wintype = '' - func CmdWinType() - let g:cmd_wintype = getcmdwintype() - let g:wintype = win_gettype() - return '' - endfunc - - call feedkeys("\a\=CmdWinType()\\") - echo input('') - call assert_equal('@', g:cmd_wintype) - call assert_equal('command', g:wintype) - - set cedit&vim - delfunc CmdWinType - endfunc - - " Test for CmdwinEnter autocmd - func Test_cmdwin_autocmd() - CheckFeature cmdwin - - augroup CmdWin - au! - autocmd BufLeave * if &buftype == '' | update | endif - autocmd CmdwinEnter * startinsert - augroup END - - call assert_fails('call feedkeys("q:xyz\", "xt")', 'E492:') - call assert_equal('xyz', @:) - - augroup CmdWin - au! - augroup END - augroup! CmdWin - endfunc - func Test_cmdlineclear_tabenter() CheckScreendump --- 1448,1453 ---- *************** *** 1649,1705 **** call delete('Xfile.java') endfunc - func Test_cmdwin_jump_to_win() - CheckFeature cmdwin - - call assert_fails('call feedkeys("q:\\\", "xt")', 'E11:') - new - set modified - call assert_fails('call feedkeys("q/:qall\", "xt")', ['E37:', 'E162:']) - close! - call feedkeys("q/:close\", "xt") - call assert_equal(1, winnr('$')) - call feedkeys("q/:exit\", "xt") - call assert_equal(1, winnr('$')) - - " opening command window twice should fail - call assert_beeps('call feedkeys("q:q:\\", "xt")') - call assert_equal(1, winnr('$')) - endfunc - - func Test_cmdwin_tabpage() - tabedit - call assert_fails("silent norm q/g :I\", 'E11:') - tabclose! - endfunc - - func Test_cmdwin_interrupted() - CheckFeature cmdwin - CheckScreendump - - " aborting the :smile output caused the cmdline window to use the current - " buffer. - let lines =<< trim [SCRIPT] - au WinNew * smile - [SCRIPT] - call writefile(lines, 'XTest_cmdwin') - - let buf = RunVimInTerminal('-S XTest_cmdwin', {'rows': 18}) - " open cmdwin - call term_sendkeys(buf, "q:") - call WaitForAssert({-> assert_match('-- More --', term_getline(buf, 18))}) - " quit more prompt for :smile command - call term_sendkeys(buf, "q") - call WaitForAssert({-> assert_match('^$', term_getline(buf, 18))}) - " execute a simple command - call term_sendkeys(buf, "aecho 'done'\") - call VerifyScreenDump(buf, 'Test_cmdwin_interrupted', {}) - - " clean up - call StopVimInTerminal(buf) - call delete('XTest_cmdwin') - endfunc - " Test for backtick expression in the command line func Test_cmd_backtick() %argd --- 1484,1489 ---- *************** *** 2033,2046 **** %bwipe! endfunc - " Test for recursively getting multiple command line inputs - func Test_cmdwin_multi_input() - CheckFeature cmdwin - - call feedkeys(":\=input('P: ')\\"cyan\\", 'xt') - call assert_equal('"cyan', @:) - endfunc - " Test for using CTRL-_ in the command line with 'allowrevins' func Test_cmdline_revins() CheckNotMSWindows --- 1817,1822 ---- *************** *** 2059,2116 **** call assert_equal('"ゔ', @:) endfunc - " Test for normal mode commands not supported in the cmd window - func Test_cmdwin_blocked_commands() - CheckFeature cmdwin - - call assert_fails('call feedkeys("q:\\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:Q\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:Z\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\s\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\v\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\^\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\n\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\z\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\o\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\w\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\j\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\k\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\h\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\l\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\T\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\x\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\r\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\R\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\K\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\}\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\]\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\f\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\d\", "xt")', 'E11:') - call assert_fails('call feedkeys("q:\g\", "xt")', 'E11:') - endfunc - - " Close the Cmd-line window in insert mode using CTRL-C - func Test_cmdwin_insert_mode_close() - CheckFeature cmdwin - - %bw! - let s = '' - exe "normal q:a\let s='Hello'\" - call assert_equal('Hello', s) - call assert_equal(1, winnr('$')) - endfunc - - func Test_cmdwin_ex_mode_with_modifier() - " this was accessing memory after allocated text in Ex mode - new - call setline(1, ['some', 'text', 'lines']) - silent! call feedkeys("gQnormal vq:atopleft\\\", 'xt') - bwipe! - endfunc - " test that ";" works to find a match at the start of the first line func Test_zero_line_search() new --- 1835,1840 ---- *** ../vim-9.0.0026/src/testdir/test_cmdwin.vim 2022-07-02 16:28:28.639245189 +0100 --- src/testdir/test_cmdwin.vim 2022-07-02 16:22:54.859625653 +0100 *************** *** 0 **** --- 1,360 ---- + " Tests for editing the command line. + + source check.vim + CheckFeature cmdwin + + source screendump.vim + + func Test_getcmdwintype() + call feedkeys("q/:let a = getcmdwintype()\:q\", 'x!') + call assert_equal('/', a) + + call feedkeys("q?:let a = getcmdwintype()\:q\", 'x!') + call assert_equal('?', a) + + call feedkeys("q::let a = getcmdwintype()\:q\", 'x!') + call assert_equal(':', a) + + call feedkeys(":\:let a = getcmdwintype()\:q\", 'x!') + call assert_equal(':', a) + + call assert_equal('', getcmdwintype()) + endfunc + + func Test_getcmdwin_autocmd() + let s:seq = [] + augroup CmdWin + au WinEnter * call add(s:seq, 'WinEnter ' .. win_getid()) + au WinLeave * call add(s:seq, 'WinLeave ' .. win_getid()) + au BufEnter * call add(s:seq, 'BufEnter ' .. bufnr()) + au BufLeave * call add(s:seq, 'BufLeave ' .. bufnr()) + au CmdWinEnter * call add(s:seq, 'CmdWinEnter ' .. win_getid()) + au CmdWinLeave * call add(s:seq, 'CmdWinLeave ' .. win_getid()) + + let org_winid = win_getid() + let org_bufnr = bufnr() + call feedkeys("q::let a = getcmdwintype()\:let s:cmd_winid = win_getid()\:let s:cmd_bufnr = bufnr()\:q\", 'x!') + call assert_equal(':', a) + call assert_equal([ + \ 'WinLeave ' .. org_winid, + \ 'WinEnter ' .. s:cmd_winid, + \ 'BufLeave ' .. org_bufnr, + \ 'BufEnter ' .. s:cmd_bufnr, + \ 'CmdWinEnter ' .. s:cmd_winid, + \ 'CmdWinLeave ' .. s:cmd_winid, + \ 'BufLeave ' .. s:cmd_bufnr, + \ 'WinLeave ' .. s:cmd_winid, + \ 'WinEnter ' .. org_winid, + \ 'BufEnter ' .. org_bufnr, + \ ], s:seq) + + au! + augroup END + endfunc + + func Test_cmdwin_bug() + let winid = win_getid() + sp + try + call feedkeys("q::call win_gotoid(" .. winid .. ")\:q\", 'x!') + catch /^Vim\%((\a\+)\)\=:E11/ + endtry + bw! + endfunc + + func Test_cmdwin_restore() + CheckScreendump + + let lines =<< trim [SCRIPT] + augroup vimHints | au! | augroup END + call setline(1, range(30)) + 2split + [SCRIPT] + call writefile(lines, 'XTest_restore') + + let buf = RunVimInTerminal('-S XTest_restore', {'rows': 12}) + call TermWait(buf, 50) + call term_sendkeys(buf, "q:") + call VerifyScreenDump(buf, 'Test_cmdwin_restore_1', {}) + + " normal restore + call term_sendkeys(buf, ":q\") + call VerifyScreenDump(buf, 'Test_cmdwin_restore_2', {}) + + " restore after setting 'lines' with one window + call term_sendkeys(buf, ":close\") + call term_sendkeys(buf, "q:") + call term_sendkeys(buf, ":set lines=18\") + call term_sendkeys(buf, ":q\") + call VerifyScreenDump(buf, 'Test_cmdwin_restore_3', {}) + + " clean up + call StopVimInTerminal(buf) + call delete('XTest_restore') + endfunc + + func Test_cmdwin_no_terminal() + CheckFeature terminal + CheckNotMSWindows + + let buf = RunVimInTerminal('', {'rows': 12}) + call TermWait(buf, 50) + call term_sendkeys(buf, ":set cmdheight=2\") + call term_sendkeys(buf, "q:") + call term_sendkeys(buf, ":let buf = term_start(['/bin/echo'], #{hidden: 1})\") + call VerifyScreenDump(buf, 'Test_cmdwin_no_terminal', {}) + call term_sendkeys(buf, ":q\") + call StopVimInTerminal(buf) + endfunc + + func Test_cmdwin_feedkeys() + " This should not generate E488 + call feedkeys("q:\", 'x') + " Using feedkeys with q: only should automatically close the cmd window + call feedkeys('q:', 'xt') + call assert_equal(1, winnr('$')) + call assert_equal('', getcmdwintype()) + endfunc + + " Tests for the issues fixed in 7.4.441. + " When 'cedit' is set to Ctrl-C, opening the command window hangs Vim + func Test_cmdwin_cedit() + exe "set cedit=\" + normal! : + call assert_equal(1, winnr('$')) + + let g:cmd_wintype = '' + func CmdWinType() + let g:cmd_wintype = getcmdwintype() + let g:wintype = win_gettype() + return '' + endfunc + + call feedkeys("\a\=CmdWinType()\\") + echo input('') + call assert_equal('@', g:cmd_wintype) + call assert_equal('command', g:wintype) + + set cedit&vim + delfunc CmdWinType + endfunc + + " Test for CmdwinEnter autocmd + func Test_cmdwin_autocmd() + augroup CmdWin + au! + autocmd BufLeave * if &buftype == '' | update | endif + autocmd CmdwinEnter * startinsert + augroup END + + call assert_fails('call feedkeys("q:xyz\", "xt")', 'E492:') + call assert_equal('xyz', @:) + + augroup CmdWin + au! + augroup END + augroup! CmdWin + endfunc + + func Test_cmdwin_jump_to_win() + call assert_fails('call feedkeys("q:\\\", "xt")', 'E11:') + new + set modified + call assert_fails('call feedkeys("q/:qall\", "xt")', ['E37:', 'E162:']) + close! + call feedkeys("q/:close\", "xt") + call assert_equal(1, winnr('$')) + call feedkeys("q/:exit\", "xt") + call assert_equal(1, winnr('$')) + + " opening command window twice should fail + call assert_beeps('call feedkeys("q:q:\\", "xt")') + call assert_equal(1, winnr('$')) + endfunc + + func Test_cmdwin_tabpage() + tabedit + call assert_fails("silent norm q/g :I\", 'E11:') + tabclose! + endfunc + + func Test_cmdwin_interrupted() + CheckScreendump + + " aborting the :smile output caused the cmdline window to use the current + " buffer. + let lines =<< trim [SCRIPT] + au WinNew * smile + [SCRIPT] + call writefile(lines, 'XTest_cmdwin') + + let buf = RunVimInTerminal('-S XTest_cmdwin', {'rows': 18}) + " open cmdwin + call term_sendkeys(buf, "q:") + call WaitForAssert({-> assert_match('-- More --', term_getline(buf, 18))}) + " quit more prompt for :smile command + call term_sendkeys(buf, "q") + call WaitForAssert({-> assert_match('^$', term_getline(buf, 18))}) + " execute a simple command + call term_sendkeys(buf, "aecho 'done'\") + call VerifyScreenDump(buf, 'Test_cmdwin_interrupted', {}) + + " clean up + call StopVimInTerminal(buf) + call delete('XTest_cmdwin') + endfunc + + " Test for recursively getting multiple command line inputs + func Test_cmdwin_multi_input() + call feedkeys(":\=input('P: ')\\"cyan\\", 'xt') + call assert_equal('"cyan', @:) + endfunc + + " Test for normal mode commands not supported in the cmd window + func Test_cmdwin_blocked_commands() + call assert_fails('call feedkeys("q:\\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:Q\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:Z\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\s\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\v\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\^\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\n\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\z\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\o\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\w\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\j\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\k\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\h\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\l\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\T\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\x\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\r\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\R\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\K\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\}\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\]\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\f\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\d\", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\g\", "xt")', 'E11:') + endfunc + + " Close the Cmd-line window in insert mode using CTRL-C + func Test_cmdwin_insert_mode_close() + %bw! + let s = '' + exe "normal q:a\let s='Hello'\" + call assert_equal('Hello', s) + call assert_equal(1, winnr('$')) + endfunc + + func Test_cmdwin_ex_mode_with_modifier() + " this was accessing memory after allocated text in Ex mode + new + call setline(1, ['some', 'text', 'lines']) + silent! call feedkeys("gQnormal vq:atopleft\\\", 'xt') + bwipe! + endfunc + + func s:ComplInCmdwin_GlobalCompletion(a, l, p) + return 'global' + endfunc + + func s:ComplInCmdwin_LocalCompletion(a, l, p) + return 'local' + endfunc + + func Test_compl_in_cmdwin() + set wildmenu wildchar= + com! -nargs=1 -complete=command GetInput let input = + com! -buffer TestCommand echo 'TestCommand' + let w:test_winvar = 'winvar' + let b:test_bufvar = 'bufvar' + + " User-defined commands + let input = '' + call feedkeys("q:iGetInput T\\\", 'tx!') + call assert_equal('TestCommand', input) + + let input = '' + call feedkeys("q::GetInput T\\:q\", 'tx!') + call assert_equal('T', input) + + + com! -nargs=1 -complete=var GetInput let input = + " Window-local variables + let input = '' + call feedkeys("q:iGetInput w:test_\\\", 'tx!') + call assert_equal('w:test_winvar', input) + + let input = '' + call feedkeys("q::GetInput w:test_\\:q\", 'tx!') + call assert_equal('w:test_', input) + + " Buffer-local variables + let input = '' + call feedkeys("q:iGetInput b:test_\\\", 'tx!') + call assert_equal('b:test_bufvar', input) + + let input = '' + call feedkeys("q::GetInput b:test_\\:q\", 'tx!') + call assert_equal('b:test_', input) + + + " Argument completion of buffer-local command + func s:ComplInCmdwin_GlobalCompletionList(a, l, p) + return ['global'] + endfunc + + func s:ComplInCmdwin_LocalCompletionList(a, l, p) + return ['local'] + endfunc + + func s:ComplInCmdwin_CheckCompletion(arg) + call assert_equal('local', a:arg) + endfunc + + com! -nargs=1 -complete=custom,ComplInCmdwin_GlobalCompletion + \ TestCommand call s:ComplInCmdwin_CheckCompletion() + com! -buffer -nargs=1 -complete=custom,ComplInCmdwin_LocalCompletion + \ TestCommand call s:ComplInCmdwin_CheckCompletion() + call feedkeys("q:iTestCommand \\", 'tx!') + + com! -nargs=1 -complete=customlist,ComplInCmdwin_GlobalCompletionList + \ TestCommand call s:ComplInCmdwin_CheckCompletion() + com! -buffer -nargs=1 -complete=customlist,ComplInCmdwin_LocalCompletionList + \ TestCommand call s:ComplInCmdwin_CheckCompletion() + + call feedkeys("q:iTestCommand \\", 'tx!') + + func! s:ComplInCmdwin_CheckCompletion(arg) + call assert_equal('global', a:arg) + endfunc + new + call feedkeys("q:iTestCommand \\", 'tx!') + quit + + delfunc s:ComplInCmdwin_GlobalCompletion + delfunc s:ComplInCmdwin_LocalCompletion + delfunc s:ComplInCmdwin_GlobalCompletionList + delfunc s:ComplInCmdwin_LocalCompletionList + delfunc s:ComplInCmdwin_CheckCompletion + + delcom -buffer TestCommand + delcom TestCommand + delcom GetInput + unlet w:test_winvar + unlet b:test_bufvar + set wildmenu& wildchar& + endfunc + + func Test_cmdwin_ctrl_bsl() + " Using CTRL-\ CTRL-N in cmd window should close the window + call feedkeys("q:\\", 'xt') + call assert_equal('', getcmdwintype()) + endfunc + + + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-9.0.0026/src/testdir/Make_all.mak 2022-04-25 14:22:51.000000000 +0100 --- src/testdir/Make_all.mak 2022-07-02 16:11:12.108541590 +0100 *************** *** 87,92 **** --- 87,93 ---- test_clientserver \ test_close_count \ test_cmdline \ + test_cmdwin \ test_command_count \ test_comments \ test_comparators \ *************** *** 345,350 **** --- 346,352 ---- test_clientserver.res \ test_close_count.res \ test_cmdline.res \ + test_cmdwin.res \ test_command_count.res \ test_comments.res \ test_comparators.res \ *** ../vim-9.0.0026/src/testdir/test_ins_complete.vim 2022-07-01 19:58:27.161837285 +0100 --- src/testdir/test_ins_complete.vim 2022-07-02 16:20:31.491796026 +0100 *************** *** 416,515 **** set completeopt& endfunc - func s:ComplInCmdwin_GlobalCompletion(a, l, p) - return 'global' - endfunc - - func s:ComplInCmdwin_LocalCompletion(a, l, p) - return 'local' - endfunc - - func Test_compl_in_cmdwin() - CheckFeature cmdwin - - set wildmenu wildchar= - com! -nargs=1 -complete=command GetInput let input = - com! -buffer TestCommand echo 'TestCommand' - let w:test_winvar = 'winvar' - let b:test_bufvar = 'bufvar' - - " User-defined commands - let input = '' - call feedkeys("q:iGetInput T\\\", 'tx!') - call assert_equal('TestCommand', input) - - let input = '' - call feedkeys("q::GetInput T\\:q\", 'tx!') - call assert_equal('T', input) - - - com! -nargs=1 -complete=var GetInput let input = - " Window-local variables - let input = '' - call feedkeys("q:iGetInput w:test_\\\", 'tx!') - call assert_equal('w:test_winvar', input) - - let input = '' - call feedkeys("q::GetInput w:test_\\:q\", 'tx!') - call assert_equal('w:test_', input) - - " Buffer-local variables - let input = '' - call feedkeys("q:iGetInput b:test_\\\", 'tx!') - call assert_equal('b:test_bufvar', input) - - let input = '' - call feedkeys("q::GetInput b:test_\\:q\", 'tx!') - call assert_equal('b:test_', input) - - - " Argument completion of buffer-local command - func s:ComplInCmdwin_GlobalCompletionList(a, l, p) - return ['global'] - endfunc - - func s:ComplInCmdwin_LocalCompletionList(a, l, p) - return ['local'] - endfunc - - func s:ComplInCmdwin_CheckCompletion(arg) - call assert_equal('local', a:arg) - endfunc - - com! -nargs=1 -complete=custom,ComplInCmdwin_GlobalCompletion - \ TestCommand call s:ComplInCmdwin_CheckCompletion() - com! -buffer -nargs=1 -complete=custom,ComplInCmdwin_LocalCompletion - \ TestCommand call s:ComplInCmdwin_CheckCompletion() - call feedkeys("q:iTestCommand \\", 'tx!') - - com! -nargs=1 -complete=customlist,ComplInCmdwin_GlobalCompletionList - \ TestCommand call s:ComplInCmdwin_CheckCompletion() - com! -buffer -nargs=1 -complete=customlist,ComplInCmdwin_LocalCompletionList - \ TestCommand call s:ComplInCmdwin_CheckCompletion() - - call feedkeys("q:iTestCommand \\", 'tx!') - - func! s:ComplInCmdwin_CheckCompletion(arg) - call assert_equal('global', a:arg) - endfunc - new - call feedkeys("q:iTestCommand \\", 'tx!') - quit - - delfunc s:ComplInCmdwin_GlobalCompletion - delfunc s:ComplInCmdwin_LocalCompletion - delfunc s:ComplInCmdwin_GlobalCompletionList - delfunc s:ComplInCmdwin_LocalCompletionList - delfunc s:ComplInCmdwin_CheckCompletion - - delcom -buffer TestCommand - delcom TestCommand - delcom GetInput - unlet w:test_winvar - unlet b:test_bufvar - set wildmenu& wildchar& - endfunc - " Test for insert path completion with completeslash option func Test_ins_completeslash() CheckMSWindows --- 416,421 ---- *************** *** 2191,2195 **** bwipe! endfunc - " vim: shiftwidth=2 sts=2 expandtab --- 2097,2100 ---- *** ../vim-9.0.0026/src/testdir/test_normal.vim 2022-06-16 13:04:09.000000000 +0100 --- src/testdir/test_normal.vim 2022-07-02 16:22:02.379687408 +0100 *************** *** 2945,2956 **** call assert_false(&insertmode) call assert_beeps("normal! \\") - if has('cmdwin') - " Using CTRL-\ CTRL-N in cmd window should close the window - call feedkeys("q:\\", 'xt') - call assert_equal('', getcmdwintype()) - endif - " clean up bw! endfunc --- 2945,2950 ---- *** ../vim-9.0.0026/src/version.c 2022-07-02 15:09:56.866464463 +0100 --- src/version.c 2022-07-02 16:10:10.940635761 +0100 *************** *** 737,738 **** --- 737,740 ---- { /* Add new patch number below this line */ + /**/ + 27, /**/ -- Change is inevitable, except from a vending machine. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///