]> granicus.if.org Git - vim/commitdiff
patch 8.2.2425: cursor on invalid line with range and :substitute v8.2.2425
authorBram Moolenaar <Bram@vim.org>
Thu, 28 Jan 2021 19:18:08 +0000 (20:18 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 28 Jan 2021 19:18:08 +0000 (20:18 +0100)
Problem:    Cursor on invalid line with range and :substitute.
Solution:   Do not move the cursor when skipping commands. (closes #3434)

src/ex_cmds.c
src/testdir/test_eval_stuff.vim
src/version.c

index 545e06dbde7de9709b533363994299442c542c49..12219e7ba56a9e1e5f65f82a6008f1a96326b8c6 100644 (file)
@@ -3747,6 +3747,8 @@ ex_substitute(exarg_T *eap)
     {
        linenr_T    joined_lines_count;
 
+       if (eap->skip)
+           return;
        curwin->w_cursor.lnum = eap->line1;
        if (*cmd == 'l')
            eap->flags = EXFLAG_LIST;
index 52e8df92422aa2bb5c1d46b14f8ba78ef77dbb84..95f5b2497db0eb482edc34f907c2bcc70572263f 100644 (file)
@@ -68,6 +68,11 @@ func Test_for_invalid()
   call assert_fails("for x in 99", 'E714:')
   call assert_fails("for x in 'asdf'", 'E714:')
   call assert_fails("for x in {'a': 9}", 'E714:')
+
+  if 0
+    /1/5/2/s/\n
+  endif
+  redraw
 endfunc
 
 func Test_readfile_binary()
index fbdb35cc63575bd38998191fb7d0fc1b04cc6bf4..2e0da2b3a783de888e3e1e5a1cfde7174e7d6d32 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2425,
 /**/
     2424,
 /**/