changeset 24383:ea2b697ddea8 v8.2.2732

patch 8.2.2732: prompt for s///c in Ex mode can be wrong Commit: https://github.com/vim/vim/commit/e5b0b98a90acf420bb611fc99534982c98d0645b Author: Bram Moolenaar <Bram@vim.org> Date: Wed Apr 7 19:42:57 2021 +0200 patch 8.2.2732: prompt for s///c in Ex mode can be wrong Problem: Prompt for s///c in Ex mode can be wrong. Solution: Position the cursor before showing the prompt. (closes https://github.com/vim/vim/issues/8073)
author Bram Moolenaar <Bram@vim.org>
date Wed, 07 Apr 2021 19:45:04 +0200
parents ba12300088d4
children 7416c47af1a5
files src/ex_cmds.c src/testdir/test_ex_mode.vim src/version.c
diffstat 3 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -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;
--- a/src/testdir/test_ex_mode.vim
+++ b/src/testdir/test_ex_mode.vim
@@ -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)
--- 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 */
 /**/
+    2732,
+/**/
     2731,
 /**/
     2730,