]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.4865: :startinsert right after :stopinsert may not work v8.2.4865
authorzeertzjq <zeertzjq@outlook.com>
Wed, 4 May 2022 16:51:50 +0000 (17:51 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 4 May 2022 16:51:50 +0000 (17:51 +0100)
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)

src/edit.c
src/testdir/test_ins_complete.vim
src/version.c

index 61c16948362f69e7cf0998d4863ddbc0328ffd0d..65b760ba04a62fe0bc5932240bfe48e542d1cca0 100644 (file)
@@ -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;
index 75ec03cb370e4fabb9364aae0a0c5ebfc55731a7..6bb499701b587ce6a943b4bf9a75601661ca5795 100644 (file)
@@ -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
 
index 19223239a7cf91a4423c91a8b74949e4f63c7940..bf2c8dc7cf8d7991b4b8217bc189f098f0ed998c 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4865,
 /**/
     4864,
 /**/