From 2fce95ec439a1121271798cf00fc8ec9878813fa Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 17 Jan 2024 08:18:52 +0800 Subject: vim-patch:9.1.0033: Insert mode not stopped if closing prompt buffer modifies hidden buffer (#27051) Problem: Insert mode not stopped if an autocommand modifies a hidden buffer while closing a prompt buffer. Solution: Don't set b_prompt_insert if stop_insert_mode is already set. (zeertzjq) closes: vim/vim#13872 https://github.com/vim/vim/commit/96958366ad6159efe708b694055320ed19357e61 --- src/nvim/window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/window.c b/src/nvim/window.c index d9a05cde17..66d090b0c8 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -2320,7 +2320,7 @@ void leaving_window(win_T *const win) // When leaving the window (or closing the window) was done from a // callback we need to break out of the Insert mode loop and restart Insert // mode when entering the window again. - if (State & MODE_INSERT) { + if ((State & MODE_INSERT) && !stop_insert_mode) { stop_insert_mode = true; if (win->w_buffer->b_prompt_insert == NUL) { win->w_buffer->b_prompt_insert = 'A'; -- cgit