1
0
forked from aniani/vim

patch 8.2.1823: "gN" does not select the matched string

Problem:    "gN" does not select the matched string.
Solution:   Move the cursor to the start of the match.
This commit is contained in:
Bram Moolenaar
2020-10-10 16:45:25 +02:00
parent f57497276b
commit 28f224b2c1
3 changed files with 13 additions and 2 deletions

View File

@@ -3047,7 +3047,7 @@ current_search(
curwin->w_cursor = end_pos; curwin->w_cursor = end_pos;
if (LT_POS(VIsual, end_pos) && forward) if (LT_POS(VIsual, end_pos) && forward)
dec_cursor(); 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 curwin->w_cursor = pos; // put the cursor on the start of the match
VIsual_active = TRUE; VIsual_active = TRUE;
VIsual_mode = 'v'; VIsual_mode = 'v';

View File

@@ -172,7 +172,16 @@ func Test_gn_command()
normal 0wgNy normal 0wgNy
call assert_equal('one', @") call assert_equal('one', @")
set selection& 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() func Test_gn_multi_line()
new new

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1823,
/**/ /**/
1822, 1822,
/**/ /**/