summaryrefslogtreecommitdiff
path: root/src/search.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-10-26 14:42:09 +0200
committerBram Moolenaar <Bram@vim.org>2019-10-26 14:42:09 +0200
commit453c19257f6d97904ec2e3823e88e63c983f2f9a (patch)
treed976cfc0526b60f792ffef69023bcad37c2c3420 /src/search.c
parentc7488a7fc8ed0d4fd9cc440117ff848170321517 (diff)
downloadvim-git-453c19257f6d97904ec2e3823e88e63c983f2f9a.tar.gz
patch 8.1.2218: "gN" is off by one in Visual modev8.1.2218
Problem: "gN" is off by one in Visual mode. Solution: Check moving forward. (Christian Brabandt, #5075)
Diffstat (limited to 'src/search.c')
-rw-r--r--src/search.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/search.c b/src/search.c
index a1f8998df..18f7905e5 100644
--- a/src/search.c
+++ b/src/search.c
@@ -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