aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-12 12:37:23 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-07-12 14:08:34 +0800
commit1abdb3224b177078b046873dadb81381960ad52b (patch)
tree688fb3b654823d7579964495fb4c5af58f7e7bd8 /src
parentd079995fb81bf3d61f7698373442f61476b99fce (diff)
downloadrneovim-1abdb3224b177078b046873dadb81381960ad52b.tar.gz
rneovim-1abdb3224b177078b046873dadb81381960ad52b.tar.bz2
rneovim-1abdb3224b177078b046873dadb81381960ad52b.zip
vim-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 vim/vim#8073) https://github.com/vim/vim/commit/e5b0b98a90acf420bb611fc99534982c98d0645b
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_cmds.c1
-rw-r--r--src/nvim/testdir/test_ex_mode.vim3
2 files changed, 4 insertions, 0 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index afded97a01..4c711d3ebc 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -3874,6 +3874,7 @@ static int do_sub(exarg_T *eap, proftime_T timeout, long cmdpreview_ns, handle_T
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;
sc += numw;
diff --git a/src/nvim/testdir/test_ex_mode.vim b/src/nvim/testdir/test_ex_mode.vim
index 5cf4e9dd2c..2b8c5bebea 100644
--- a/src/nvim/testdir/test_ex_mode.vim
+++ b/src/nvim/testdir/test_ex_mode.vim
@@ -78,6 +78,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)