mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
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 #4980)
This commit is contained in:
@@ -4152,12 +4152,15 @@ open_cmdwin(void)
|
|||||||
invalidate_botline();
|
invalidate_botline();
|
||||||
redraw_later(SOME_VALID);
|
redraw_later(SOME_VALID);
|
||||||
|
|
||||||
/* No Ex mode here! */
|
// No Ex mode here!
|
||||||
exmode_active = 0;
|
exmode_active = 0;
|
||||||
|
|
||||||
State = NORMAL;
|
State = NORMAL;
|
||||||
setmouse();
|
setmouse();
|
||||||
|
|
||||||
|
// Reset here so it can be set by a CmdWinEnter autocommand.
|
||||||
|
cmdwin_result = 0;
|
||||||
|
|
||||||
// Trigger CmdwinEnter autocommands.
|
// Trigger CmdwinEnter autocommands.
|
||||||
trigger_cmd_autocmd(cmdwin_type, EVENT_CMDWINENTER);
|
trigger_cmd_autocmd(cmdwin_type, EVENT_CMDWINENTER);
|
||||||
if (restart_edit != 0) // autocmd with ":startinsert"
|
if (restart_edit != 0) // autocmd with ":startinsert"
|
||||||
@@ -4169,7 +4172,6 @@ open_cmdwin(void)
|
|||||||
/*
|
/*
|
||||||
* Call the main loop until <CR> or CTRL-C is typed.
|
* Call the main loop until <CR> or CTRL-C is typed.
|
||||||
*/
|
*/
|
||||||
cmdwin_result = 0;
|
|
||||||
main_loop(TRUE, FALSE);
|
main_loop(TRUE, FALSE);
|
||||||
|
|
||||||
RedrawingDisabled = i;
|
RedrawingDisabled = i;
|
||||||
|
@@ -2259,3 +2259,32 @@ func Test_autocmd_SafeState()
|
|||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
call delete('XSafeState')
|
call delete('XSafeState')
|
||||||
endfunc
|
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
|
||||||
|
@@ -753,6 +753,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2108,
|
||||||
/**/
|
/**/
|
||||||
2107,
|
2107,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user