patch 9.1.0040: issue with prompt buffer and hidden buffer

Problem:  Modifying a hidden buffer still interferes with prompt buffer
          mode changes.
Solution: Save and restore b_prompt_insert.
          (zeertzjq)

closes: #13875

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Modifying hidden buffer still interferes with prompt buffer mode changes
diff --git a/src/autocmd.c b/src/autocmd.c
index 8b8f109..80ce8ca 100644
--- a/src/autocmd.c
+++ b/src/autocmd.c
@@ -1565,9 +1565,12 @@
     }
 
     aco->save_curwin_id = curwin->w_id;
-    aco->save_curbuf = curbuf;
     aco->save_prevwin_id = prevwin == NULL ? 0 : prevwin->w_id;
     aco->save_State = State;
+#ifdef FEAT_JOB_CHANNEL
+    if (bt_prompt(curbuf))
+	aco->save_prompt_insert = curbuf->b_prompt_insert;
+#endif
 
     if (win != NULL)
     {
@@ -1692,6 +1695,8 @@
 #ifdef FEAT_JOB_CHANNEL
 	// May need to restore insert mode for a prompt buffer.
 	entering_window(curwin);
+	if (bt_prompt(curbuf))
+	    curbuf->b_prompt_insert = aco->save_prompt_insert;
 #endif
 	prevwin = win_find_by_id(aco->save_prevwin_id);
 #ifdef FEAT_EVAL