diff options
-rw-r--r-- | src/nvim/search.c | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_gn.vim | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/nvim/search.c b/src/nvim/search.c index ea2107c5c7..82f2cf28ab 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -4186,7 +4186,7 @@ current_search( curwin->w_cursor = end_pos; if (lt(VIsual, end_pos) && forward) { dec_cursor(); - } else if (VIsual_active && lt(curwin->w_cursor, VIsual)) { + } else if (VIsual_active && lt(curwin->w_cursor, VIsual) && forward) { curwin->w_cursor = pos; // put the cursor on the start of the match } VIsual_active = true; diff --git a/src/nvim/testdir/test_gn.vim b/src/nvim/testdir/test_gn.vim index d41675be0c..8f800a7c79 100644 --- a/src/nvim/testdir/test_gn.vim +++ b/src/nvim/testdir/test_gn.vim @@ -158,7 +158,16 @@ func Test_gn_command() set wrapscan&vim set belloff&vim -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 |