aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/autocmd.c7
-rw-r--r--src/nvim/autocmd_defs.h2
2 files changed, 7 insertions, 2 deletions
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index b44158c890..a385161beb 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -1302,9 +1302,11 @@ void aucmd_prepbuf(aco_save_T *aco, buf_T *buf)
}
aco->save_curwin_handle = curwin->handle;
- aco->save_curbuf = curbuf;
aco->save_prevwin_handle = prevwin == NULL ? 0 : prevwin->handle;
aco->save_State = State;
+ if (bt_prompt(curbuf)) {
+ aco->save_prompt_insert = curbuf->b_prompt_insert;
+ }
if (win != NULL) {
// There is a window for "buf" in the current tab page, make it the
@@ -1417,6 +1419,9 @@ win_found:
curbuf = curwin->w_buffer;
// 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;
+ }
prevwin = win_find_by_handle(aco->save_prevwin_handle);
vars_clear(&awp->w_vars->dv_hashtab); // free all w: variables
diff --git a/src/nvim/autocmd_defs.h b/src/nvim/autocmd_defs.h
index d1f1e16e1a..6535f8a7ea 100644
--- a/src/nvim/autocmd_defs.h
+++ b/src/nvim/autocmd_defs.h
@@ -14,7 +14,6 @@
/// Struct to save values in before executing autocommands for a buffer that is
/// not the current buffer.
typedef struct {
- buf_T *save_curbuf; ///< saved curbuf
int use_aucmd_win_idx; ///< index in aucmd_win[] if >= 0
handle_T save_curwin_handle; ///< ID of saved curwin
handle_T new_curwin_handle; ///< ID of new curwin
@@ -23,6 +22,7 @@ typedef struct {
char *globaldir; ///< saved value of globaldir
bool save_VIsual_active; ///< saved VIsual_active
int save_State; ///< saved State
+ int save_prompt_insert; ///< saved b_prompt_insert
} aco_save_T;
typedef struct {