diff src/testdir/test_cmdline.vim @ 18043:5a0d5f8e1778 v8.1.2017

patch 8.1.2017: cannot execute commands after closing the cmdline window Commit: https://github.com/vim/vim/commit/96e38a86a710fb6daec4550ac1667f019dc3a40e Author: Bram Moolenaar <Bram@vim.org> Date: Mon Sep 9 18:35:33 2019 +0200 patch 8.1.2017: cannot execute commands after closing the cmdline window Problem: Cannot execute commands after closing the cmdline window. Solution: Also trigger BufEnter and WinEnter. (closes https://github.com/vim/vim/issues/4762)
author Bram Moolenaar <Bram@vim.org>
date Mon, 09 Sep 2019 18:45:04 +0200
parents 0dcc2ee838dd
children f4b51934d4f8
line wrap: on
line diff
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -604,6 +604,8 @@ func Check_cmdline(cmdtype)
   return ''
 endfunc
 
+set cpo&
+
 func Test_getcmdtype()
   call feedkeys(":MyCmd a\<C-R>=Check_cmdline(':')\<CR>\<Esc>", "xt")
 
@@ -644,6 +646,37 @@ func Test_getcmdwintype()
   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()\<CR>:let s:cmd_winid = win_getid()\<CR>:let s:cmd_bufnr = bufnr()\<CR>:q\<CR>", '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'
@@ -701,5 +734,3 @@ func Test_cmdline_overstrike()
 
   let &encoding = encoding_save
 endfunc
-
-set cpo&