summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-10-10 16:45:25 +0200
committerBram Moolenaar <Bram@vim.org>2020-10-10 16:45:25 +0200
commit28f224b2c1bd2fcdee7b4fe2c64826e1cff08f39 (patch)
tree97358abc990845e2b24a098e56f994f62d244ba4
parentf57497276bc616d3856eeff9824c080941faa51b (diff)
patch 8.2.1823: "gN" does not select the matched stringv8.2.1823
Problem: "gN" does not select the matched string. Solution: Move the cursor to the start of the match.
-rw-r--r--src/search.c2
-rw-r--r--src/testdir/test_gn.vim11
-rw-r--r--src/version.c2
3 files changed, 13 insertions, 2 deletions
diff --git a/src/search.c b/src/search.c
index fd668383b7..45e4f9c1ab 100644
--- a/src/search.c
+++ b/src/search.c
@@ -3047,7 +3047,7 @@ current_search(
curwin->w_cursor = end_pos;
if (LT_POS(VIsual, end_pos) && forward)
dec_cursor();
- else if (VIsual_active && LT_POS(curwin->w_cursor, VIsual))
+ else if (VIsual_active && LT_POS(curwin->w_cursor, VIsual) && forward)
curwin->w_cursor = pos; // put the cursor on the start of the match
VIsual_active = TRUE;
VIsual_mode = 'v';
diff --git a/src/testdir/test_gn.vim b/src/testdir/test_gn.vim
index b90aa5f1d6..a2a7ac3f0f 100644
--- a/src/testdir/test_gn.vim
+++ b/src/testdir/test_gn.vim
@@ -172,7 +172,16 @@ func Test_gn_command()
normal 0wgNy
call assert_equal('one', @")
set selection&
-endfu
+endfunc
+
+func Test_gN_repeat()
+ new
+ call setline(1, 'this list is a list with a list of a list.')
+ /list
+ normal $gNgNgNx
+ call assert_equal('list with a list of a list', @")
+ bwipe!
+endfunc
func Test_gn_multi_line()
new
diff --git a/src/version.c b/src/version.c
index e0bcc90129..e30c02dd15 100644
--- 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 */
/**/
+ 1823,
+/**/
1822,
/**/
1821,