]> granicus.if.org Git - vim/commitdiff
patch 8.2.2732: prompt for s///c in Ex mode can be wrong v8.2.2732
authorBram Moolenaar <Bram@vim.org>
Wed, 7 Apr 2021 17:42:57 +0000 (19:42 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 7 Apr 2021 17:42:57 +0000 (19:42 +0200)
Problem:    Prompt for s///c in Ex mode can be wrong.
Solution:   Position the cursor before showing the prompt. (closes #8073)

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

index 90a9403ff373680cc1674a23314d4de890290b45..6cd54d20ce690a59632cef9461998782e20e5818 100644 (file)
@@ -4153,6 +4153,7 @@ ex_substitute(exarg_T *eap)
                            if (curwin->w_cursor.col < 0)
                                curwin->w_cursor.col = 0;
                            getvcol(curwin, &curwin->w_cursor, NULL, NULL, &ec);
+                           curwin->w_cursor.col = regmatch.startpos[0].col;
                            if (subflags.do_number || curwin->w_p_nu)
                            {
                                int numw = number_width(curwin) + 1;
index ffde11e3e9e072b23c9884d2d6927f049d9a9978..a761cbf8b41331be514c7e1f4ab540306c0abdd2 100644 (file)
@@ -77,6 +77,9 @@ func Test_Ex_substitute()
   call WaitForAssert({-> assert_match('  1 foo foo', term_getline(buf, 5))},
         \ 1000)
   call WaitForAssert({-> assert_match('    ^^^', term_getline(buf, 6))}, 1000)
+  call term_sendkeys(buf, "N\<CR>")
+  call term_wait(buf)
+  call WaitForAssert({-> assert_match('    ^^^', term_getline(buf, 6))}, 1000)
   call term_sendkeys(buf, "n\<CR>")
   call WaitForAssert({-> assert_match('        ^^^', term_getline(buf, 6))},
         \ 1000)
index 7a865de2a116a74168ef26e976b96d1a01af00af..0bf907354c38127cc8b7330fe303b3e7cac90120 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2732,
 /**/
     2731,
 /**/