To: vim_dev@googlegroups.com Subject: Patch 8.2.1939 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1939 Problem: Invalid memory access in Ex mode with global command. Solution: Make sure the cursor is on a valid line. (closes #7238) Files: src/move.c, src/testdir/test_ex_mode.vim *** ../vim-8.2.1938/src/move.c 2020-09-26 22:02:38.135641113 +0200 --- src/move.c 2020-11-01 21:20:36.598511815 +0100 *************** *** 196,201 **** --- 196,202 ---- // the cursor line. if (!screen_valid(TRUE) || curwin->w_height == 0) { + check_cursor_lnum(); curwin->w_topline = curwin->w_cursor.lnum; curwin->w_botline = curwin->w_topline; curwin->w_valid |= VALID_BOTLINE|VALID_BOTLINE_AP; *** ../vim-8.2.1938/src/testdir/test_ex_mode.vim 2020-06-18 17:28:36.857031469 +0200 --- src/testdir/test_ex_mode.vim 2020-11-01 21:53:56.713500383 +0100 *************** *** 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,182 **** --- 180,207 ---- 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 *** ../vim-8.2.1938/src/version.c 2020-11-01 20:58:22.839423327 +0100 --- src/version.c 2020-11-01 21:19:45.894674450 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 1939, /**/ -- If Microsoft would build a car... ... Occasionally your car would die on the freeway for no reason. You would have to pull over to the side of the road, close all of the car windows, shut it off, restart it, and reopen the windows before you could continue. For some reason you would simply accept this. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///