Mercurial > vim
diff src/testdir/test_autocmd.vim @ 18227:7d90fa3e5f8d v8.1.2108
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Commit: https://github.com/vim/vim/commit/23324a0b35d18c5caac20b1d543ed2d1f762f5b5
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Oct 1 17:39:04 2019 +0200
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Problem: Cannot close the cmdline window from CmdWinEnter. (George Brown)
Solution: Reset cmdwin_result earlier. (Christian Brabandt, closes https://github.com/vim/vim/issues/4980)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 01 Oct 2019 17:45:04 +0200 |
parents | f7d9f8fe70be |
children | 0cb608fc9c60 |
line wrap: on
line diff
--- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -2259,3 +2259,32 @@ func Test_autocmd_SafeState() call StopVimInTerminal(buf) call delete('XSafeState') endfunc + +func Test_autocmd_CmdWinEnter() + CheckRunVimInTerminal + " There is not cmdwin switch, so + " test for cmdline_hist + " (both are available with small builds) + CheckFeature cmdline_hist + let lines =<< trim END + let b:dummy_var = 'This is a dummy' + autocmd CmdWinEnter * quit + let winnr = winnr('$') + END + let filename='XCmdWinEnter' + call writefile(lines, filename) + let buf = RunVimInTerminal('-S '.filename, #{rows: 6}) + + call term_sendkeys(buf, "q:") + call term_wait(buf) + call term_sendkeys(buf, ":echo b:dummy_var\<cr>") + call WaitForAssert({-> assert_match('^This is a dummy', term_getline(buf, 6))}, 1000) + call term_sendkeys(buf, ":echo &buftype\<cr>") + call WaitForAssert({-> assert_notmatch('^nofile', term_getline(buf, 6))}, 1000) + call term_sendkeys(buf, ":echo winnr\<cr>") + call WaitForAssert({-> assert_match('^1', term_getline(buf, 6))}, 1000) + + " clean up + call StopVimInTerminal(buf) + call delete(filename) +endfunc