diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-04-10 07:33:26 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-10 07:33:26 +0800 |
commit | d52cc668c736ef6ca7ee3655a7eb7fe6475afadc (patch) | |
tree | 4dcad35062230be2b9095bc13a11d4d60157622a /src | |
parent | 71225228fc2700a18c56c57f9dc14494cef83149 (diff) | |
download | rneovim-d52cc668c736ef6ca7ee3655a7eb7fe6475afadc.tar.gz rneovim-d52cc668c736ef6ca7ee3655a7eb7fe6475afadc.tar.bz2 rneovim-d52cc668c736ef6ca7ee3655a7eb7fe6475afadc.zip |
vim-patch:9.0.1443: ending Insert mode when accessing a hidden prompt buffer (#22984)
Problem: Ending Insert mode when accessing a hidden prompt buffer.
Solution: Don't stop Insert mode when it was active before. (closes vim/vim#12237)
https://github.com/vim/vim/commit/05a627c3d4e42a18f76c14828d68ee4747118211
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/autocmd.c | 6 | ||||
-rw-r--r-- | src/nvim/autocmd.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c index f1ce919942..726344a42b 100644 --- a/src/nvim/autocmd.c +++ b/src/nvim/autocmd.c @@ -1421,6 +1421,8 @@ 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 (win != NULL) { // There is a window for "buf" in the current tab page, make it the // curwin. This is preferred, it has the least side effects (esp. if @@ -1497,6 +1499,10 @@ void aucmd_restbuf(aco_save_T *aco) win_found: // 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; + } // Remove the window. win_remove(curwin, NULL); pmap_del(handle_T)(&window_handles, curwin->handle); diff --git a/src/nvim/autocmd.h b/src/nvim/autocmd.h index 791b589167..6dbd18ba7c 100644 --- a/src/nvim/autocmd.h +++ b/src/nvim/autocmd.h @@ -32,6 +32,7 @@ typedef struct { bufref_T new_curbuf; ///< new curbuf char *globaldir; ///< saved value of globaldir bool save_VIsual_active; ///< saved VIsual_active + int save_State; ///< saved State } aco_save_T; typedef struct AutoCmd_S AutoCmd; |