changeset 28682:c1591fa6f81a v8.2.4865

patch 8.2.4865: :startinsert right after :stopinsert may not work Commit: https://github.com/vim/vim/commit/cd5dbad184e8235beb13dcd8a22302da09db9766 Author: zeertzjq <zeertzjq@outlook.com> Date: Wed May 4 17:51:50 2022 +0100 patch 8.2.4865: :startinsert right after :stopinsert may not work Problem: :startinsert right after :stopinsert does not work when popup menu is still visible. Solution: Use ins_compl_active() instead of pum_visible(). (closes #10352)
author Bram Moolenaar <Bram@vim.org>
date Wed, 04 May 2022 19:00:04 +0200
parents 1d008ef222ea
children ce2bb6d9b763
files src/edit.c src/testdir/test_ins_complete.vim src/version.c
diffstat 3 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/edit.c
+++ b/src/edit.c
@@ -448,7 +448,7 @@ edit(
 	if (update_Insstart_orig)
 	    Insstart_orig = Insstart;
 
-	if (stop_insert_mode && !pum_visible())
+	if (stop_insert_mode && !ins_compl_active())
 	{
 	    // ":stopinsert" used or 'insertmode' reset
 	    count = 0;
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -555,6 +555,15 @@ func Test_pum_stopped_by_timer()
   call delete('Xpumscript')
 endfunc
 
+func Test_complete_stopinsert_startinsert()
+  nnoremap <F2> <Cmd>startinsert<CR>
+  inoremap <F2> <Cmd>stopinsert<CR>
+  " This just checks if this causes an error
+  call feedkeys("i\<C-X>\<C-N>\<F2>\<F2>", 'x')
+  nunmap <F2>
+  iunmap <F2>
+endfunc
+
 func Test_pum_with_folds_two_tabs()
   CheckScreendump
 
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4865,
+/**/
     4864,
 /**/
     4863,