diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-04-08 11:56:14 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-04-08 11:56:14 +0100 |
commit | 3a56b6d405fc0f1ca928b77382f97d0c552bea64 (patch) | |
tree | 14723611ebb679b54619d713c26a80c9a9696206 /src | |
parent | ac72c21da696cf6c31630a9e5ff4c0d3e2049c11 (diff) |
patch 8.2.4711: when 'insermode' is set :edit from <Cmd> mapping misbehavesv8.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)
Diffstat (limited to 'src')
-rw-r--r-- | src/ex_cmds.c | 2 | ||||
-rw-r--r-- | src/testdir/test_edit.vim | 23 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 26 insertions, 1 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 8cdac4b74e..50829be70b 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -3182,7 +3182,7 @@ do_ecmd( redraw_curbuf_later(NOT_VALID); // redraw this buffer later } - if (p_im) + if (p_im && (State & INSERT) == 0) need_start_insertmode = TRUE; #ifdef FEAT_AUTOCHDIR diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim index a96a95bd3a..9ed899d838 100644 --- a/src/testdir/test_edit.vim +++ b/src/testdir/test_edit.vim @@ -1840,6 +1840,29 @@ func Test_edit_file_no_read_perm() 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 diff --git a/src/version.c b/src/version.c index 956100304b..54efff406a 100644 --- 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 */ /**/ + 4711, +/**/ 4710, /**/ 4709, |