From f95ad61a8945b64a58750073e2cb2beb30767062 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 14 Jan 2023 19:32:12 +0800 Subject: vim-patch:8.2.4391: command line executed when typing Esc in the GUI Problem: Command line executed when typing Esc in the GUI. Solution: Move saving/restoring KeyTyped to build_stl_str_hl(). (closes vim/vim#9783) https://github.com/vim/vim/commit/0e1f36fc59b589e4755fd9102013971f45222084 Co-authored-by: Bram Moolenaar --- src/nvim/statusline.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c index ca157ba697..db3e3f91bf 100644 --- a/src/nvim/statusline.c +++ b/src/nvim/statusline.c @@ -268,7 +268,6 @@ static void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler) StlClickRecord *tabtab; win_T *ewp; int p_crb_save; - bool save_KeyTyped = KeyTyped; bool is_stl_global = global_stl_height() > 0; ScreenGrid *grid = &default_grid; @@ -423,9 +422,6 @@ static void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler) theend: entered = false; - - // A user function may reset KeyTyped, restore it. - KeyTyped = save_KeyTyped; } void win_redr_winbar(win_T *wp) @@ -948,6 +944,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n char *usefmt = fmt; const int save_must_redraw = must_redraw; const int save_redr_type = curwin->w_redr_type; + const bool save_KeyTyped = KeyTyped; // TODO(Bram): find out why using called_emsg_before makes tests fail, does it // matter? // const int called_emsg_before = called_emsg; @@ -2153,5 +2150,8 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n set_string_option_direct(opt_name, -1, "", OPT_FREE | opt_scope, SID_ERROR); } + // A user function may reset KeyTyped, restore it. + KeyTyped = save_KeyTyped; + return width; } -- cgit