From 1abdb3224b177078b046873dadb81381960ad52b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 12 Jul 2022 12:37:23 +0800 Subject: 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 --- src/nvim/ex_cmds.c | 1 + src/nvim/testdir/test_ex_mode.vim | 3 +++ 2 files changed, 4 insertions(+) (limited to 'src') 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\") + call term_wait(buf) + call WaitForAssert({-> assert_match(' ^^^', term_getline(buf, 6))}, 1000) call term_sendkeys(buf, "n\") call WaitForAssert({-> assert_match(' ^^^', term_getline(buf, 6))}, \ 1000) -- cgit