summaryrefslogtreecommitdiffstats
path: root/src/autocmd.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-05-27 14:10:08 +0100
committerBram Moolenaar <Bram@vim.org>2023-05-27 14:10:08 +0100
commita40c0bcc83c32da02869f59b10538d6327df61c5 (patch)
tree324d7b8cf77e91910d71ae804b335a12dd0400ae /src/autocmd.c
parenta1d5f9f33c68d06475406d6f44d307d5e01adc01 (diff)
patch 9.0.1582: :stopinsert may not work in a popup close handlerv9.0.1582
Problem: :stopinsert may not work in a popup close handler. (Ben Jackson) Solution: Restore stop_insert_mode when appropriate. (closes #12452, closes #12434)
Diffstat (limited to 'src/autocmd.c')
-rw-r--r--src/autocmd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/autocmd.c b/src/autocmd.c
index c93d4bd754..862ddf7ccc 100644
--- a/src/autocmd.c
+++ b/src/autocmd.c
@@ -1657,11 +1657,13 @@ aucmd_restbuf(
}
win_found:
#ifdef FEAT_JOB_CHANNEL
+ ;
+ int save_stop_insert_mode = stop_insert_mode;
// May need to stop Insert mode if we were in a prompt buffer.
leaving_window(curwin);
// Do not stop Insert mode when already in Insert mode before.
if (aco->save_State & MODE_INSERT)
- stop_insert_mode = FALSE;
+ stop_insert_mode = save_stop_insert_mode;
#endif
// Remove the window and frame from the tree of frames.
(void)winframe_remove(curwin, &dummy, NULL);