Mercurial > vim
comparison src/testdir/test_ex_mode.vim @ 22782:53b996eb5e76 v8.2.1939
patch 8.2.1939: invalid memory access in Ex mode with global command
Commit: https://github.com/vim/vim/commit/3b6d57f2ce87dc5a4b1a50e1b0fd2aeaf72faae2
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Nov 1 21:56:40 2020 +0100
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 https://github.com/vim/vim/issues/7238)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 01 Nov 2020 22:00:04 +0100 |
parents | 213fb059e02e |
children | 6fd35e873309 |
comparison
equal
deleted
inserted
replaced
22781:d67c6dd3d99b | 22782:53b996eb5e76 |
---|---|
1 " Test editing line in Ex mode (see :help Q and :help gQ). | 1 " Test editing line in Ex mode (see :help Q and :help gQ). |
2 | 2 |
3 source check.vim | 3 source check.vim |
4 source shared.vim | |
4 | 5 |
5 " Helper function to test editing line in Q Ex mode | 6 " Helper function to test editing line in Q Ex mode |
6 func Ex_Q(cmd) | 7 func Ex_Q(cmd) |
7 " Is there a simpler way to test editing Ex line? | 8 " Is there a simpler way to test editing Ex line? |
8 call feedkeys("Q" | 9 call feedkeys("Q" |
177 au! CmdLineEnter | 178 au! CmdLineEnter |
178 delfunc ExEnterFunc | 179 delfunc ExEnterFunc |
179 quit | 180 quit |
180 endfunc | 181 endfunc |
181 | 182 |
183 func Test_ex_mode_with_global() | |
184 CheckFeature timers | |
185 | |
186 " This will get stuck in Normal mode after the failed "J", use a timer to | |
187 " get going again. | |
188 let lines =<< trim END | |
189 call ch_logfile('logfile', 'w') | |
190 pedit | |
191 func FeedQ(id) | |
192 call feedkeys('Q', 't') | |
193 endfunc | |
194 call timer_start(10, 'FeedQ') | |
195 g/^/vi|HJ | |
196 call writefile(['done'], 'Xdidexmode') | |
197 qall! | |
198 END | |
199 call writefile(lines, 'Xexmodescript') | |
200 call assert_equal(1, RunVim([], [], '-e -s -S Xexmodescript')) | |
201 call assert_equal(['done'], readfile('Xdidexmode')) | |
202 | |
203 call delete('Xdidexmode') | |
204 call delete('Xexmodescript') | |
205 endfunc | |
206 | |
182 " vim: shiftwidth=2 sts=2 expandtab | 207 " vim: shiftwidth=2 sts=2 expandtab |