0
0
mirror of https://github.com/vim/vim.git synced 2025-10-13 06:54:15 -04:00

patch 8.2.1939: invalid memory access in Ex mode with global command

Problem:    Invalid memory access in Ex mode with global command.
Solution:   Make sure the cursor is on a valid line. (closes #7238)
This commit is contained in:
Bram Moolenaar
2020-11-01 21:56:40 +01:00
parent a46765a797
commit 3b6d57f2ce
3 changed files with 28 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
" Test editing line in Ex mode (see :help Q and :help gQ).
source check.vim
source shared.vim
" Helper function to test editing line in Q Ex mode
func Ex_Q(cmd)
@@ -179,4 +180,28 @@ func Test_ex_mode_errors()
quit
endfunc
func Test_ex_mode_with_global()
CheckFeature timers
" This will get stuck in Normal mode after the failed "J", use a timer to
" get going again.
let lines =<< trim END
call ch_logfile('logfile', 'w')
pedit
func FeedQ(id)
call feedkeys('Q', 't')
endfunc
call timer_start(10, 'FeedQ')
g/^/vi|HJ
call writefile(['done'], 'Xdidexmode')
qall!
END
call writefile(lines, 'Xexmodescript')
call assert_equal(1, RunVim([], [], '-e -s -S Xexmodescript'))
call assert_equal(['done'], readfile('Xdidexmode'))
call delete('Xdidexmode')
call delete('Xexmodescript')
endfunc
" vim: shiftwidth=2 sts=2 expandtab