vim-patch:8.2.1000: get error when leaving Ex mode with :visual

Problem:    Get error when leaving Ex mode with :visual and a CmdLineEnter
            autocommand was used.
Solution:   Reset ex_pressedreturn. (closes vim/vim#6293)
158ea175a9
This commit is contained in:
Jan Edmund Lazo 2021-05-11 21:10:14 -04:00
parent d5b9a7d6e8
commit 7339290900
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15
2 changed files with 27 additions and 0 deletions

View File

@ -7305,6 +7305,7 @@ do_exedit(
if (exmode_active && (eap->cmdidx == CMD_visual
|| eap->cmdidx == CMD_view)) {
exmode_active = FALSE;
ex_pressedreturn = false;
if (*eap->arg == NUL) {
/* Special case: ":global/pat/visual\NLvi-commands" */
if (global_busy) {

View File

@ -54,3 +54,29 @@ func Test_ex_mode()
set sw&
let &encoding = encoding_save
endfunc
func Test_ex_mode_errors()
" Not allowed to enter ex mode when text is locked
au InsertCharPre <buffer> normal! gQ<CR>
let caught_e523 = 0
try
call feedkeys("ix\<esc>", 'xt')
catch /^Vim\%((\a\+)\)\=:E523/ " catch E523
let caught_e523 = 1
endtry
call assert_equal(1, caught_e523)
au! InsertCharPre
new
au CmdLineEnter * call ExEnterFunc()
func ExEnterFunc()
endfunc
call feedkeys("gQvi\r", 'xt')
au! CmdLineEnter
delfunc ExEnterFunc
quit
endfunc
" vim: shiftwidth=2 sts=2 expandtab