Patch 8.2.4711
Problem: When 'insermode' is set :edit from <Cmd> mapping misbehaves.
Solution: Don't set "need_start_insertmode" when already in Insert mode.
(closes #10116)
Files: src/ex_cmds.c, src/testdir/test_edit.vim
*** ../vim-8.2.4710/src/ex_cmds.c 2022-04-03 12:59:29.354392494 +0100
--- src/ex_cmds.c 2022-04-08 11:53:36.203604188 +0100
***************
*** 3182,3188 ****
redraw_curbuf_later(NOT_VALID); // redraw this buffer later
}
! if (p_im)
need_start_insertmode = TRUE;
#ifdef FEAT_AUTOCHDIR
--- 3182,3188 ----
redraw_curbuf_later(NOT_VALID); // redraw this buffer later
}
! if (p_im && (State & INSERT) == 0)
need_start_insertmode = TRUE;
#ifdef FEAT_AUTOCHDIR
*** ../vim-8.2.4710/src/testdir/test_edit.vim 2022-04-03 18:01:39.659574455
+0100
--- src/testdir/test_edit.vim 2022-04-08 11:53:36.203604188 +0100
***************
*** 1840,1845 ****
--- 1840,1868 ----
call delete('Xfile')
endfunc
+ " Using :edit without leaving 'insertmode' should not cause Insert mode to be
+ " re-entered immediately after <C-L>
+ func Test_edit_insertmode_ex_edit()
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ set insertmode noruler
+ inoremap <C-B> <Cmd>edit Xfoo<CR>
+ END
+ call writefile(lines, 'Xtest_edit_insertmode_ex_edit')
+
+ let buf = RunVimInTerminal('-S Xtest_edit_insertmode_ex_edit', #{rows: 6})
+ call TermWait(buf, 50)
+ call assert_match('^-- INSERT --\s*$', term_getline(buf, 6))
+ call term_sendkeys(buf, "\<C-B>\<C-L>")
+ call TermWait(buf, 50)
+ call assert_notmatch('^-- INSERT --\s*$', term_getline(buf, 6))
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('Xtest_edit_insertmode_ex_edit')
+ endfunc
+
" Pressing escape in 'insertmode' should beep
func Test_edit_insertmode_esc_beeps()
new
*** ../vim-8.2.4710/src/version.c 2022-04-07 21:00:49.423544896 +0100
--- src/version.c 2022-04-08 11:55:24.799485642 +0100
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4711,
/**/
--
Did Adam and Eve have navels?
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220408105658.3317D1C04C0%40moolenaar.net.