changeset 23768:1a53383f08e5 v8.2.2425

patch 8.2.2425: cursor on invalid line with range and :substitute Commit: https://github.com/vim/vim/commit/df2c2988bbaecd28b0fbec8d64327b1bbb005e19 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 28 20:18:08 2021 +0100 patch 8.2.2425: cursor on invalid line with range and :substitute Problem: Cursor on invalid line with range and :substitute. Solution: Do not move the cursor when skipping commands. (closes https://github.com/vim/vim/issues/3434)
author Bram Moolenaar <Bram@vim.org>
date Thu, 28 Jan 2021 20:30:03 +0100
parents 51c399104d33
children 3dd5ed701137
files src/ex_cmds.c src/testdir/test_eval_stuff.vim src/version.c
diffstat 3 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -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;
--- a/src/testdir/test_eval_stuff.vim
+++ b/src/testdir/test_eval_stuff.vim
@@ -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()
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2425,
+/**/
     2424,
 /**/
     2423,