1
0
forked from aniani/vim

patch 8.1.2218: "gN" is off by one in Visual mode

Problem:    "gN" is off by one in Visual mode.
Solution:   Check moving forward. (Christian Brabandt, #5075)
This commit is contained in:
Bram Moolenaar
2019-10-26 14:42:09 +02:00
parent c7488a7fc8
commit 453c19257f
3 changed files with 9 additions and 2 deletions

View File

@@ -4677,7 +4677,7 @@ abort_search:
#endif /* FEAT_TEXTOBJ */
/*
* Check if the pattern is one character long or zero-width.
* Check if the pattern is zero-width.
* If move is TRUE, check from the beginning of the buffer, else from position
* "cur".
* "direction" is FORWARD or BACKWARD.
@@ -4851,7 +4851,7 @@ current_search(
// put cursor on last character of match
curwin->w_cursor = end_pos;
if (LT_POS(VIsual, end_pos))
if (LT_POS(VIsual, end_pos) && forward)
dec_cursor();
else if (VIsual_active && LT_POS(curwin->w_cursor, VIsual))
curwin->w_cursor = pos; // put the cursor on the start of the match