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)
diff --git a/src/ex_getln.c b/src/ex_getln.c
index ef8e387..ef87413 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -136,11 +136,11 @@
// Struct to store the state of 'incsearch' highlighting.
typedef struct {
pos_T search_start; // where 'incsearch' starts searching
- pos_T save_cursor;
+ pos_T save_cursor;
viewstate_T init_viewstate;
viewstate_T old_viewstate;
- pos_T match_start;
- pos_T match_end;
+ pos_T match_start;
+ pos_T match_end;
int did_incsearch;
int incsearch_postponed;
int magic_save;
@@ -4152,12 +4152,15 @@
invalidate_botline();
redraw_later(SOME_VALID);
- /* No Ex mode here! */
+ // No Ex mode here!
exmode_active = 0;
State = NORMAL;
setmouse();
+ // Reset here so it can be set by a CmdWinEnter autocommand.
+ cmdwin_result = 0;
+
// Trigger CmdwinEnter autocommands.
trigger_cmd_autocmd(cmdwin_type, EVENT_CMDWINENTER);
if (restart_edit != 0) // autocmd with ":startinsert"
@@ -4169,7 +4172,6 @@
/*
* Call the main loop until <CR> or CTRL-C is typed.
*/
- cmdwin_result = 0;
main_loop(TRUE, FALSE);
RedrawingDisabled = i;