Mercurial > vim
diff src/search.c @ 18448:35e0ab1f2975 v8.1.2218
patch 8.1.2218: "gN" is off by one in Visual mode
Commit: https://github.com/vim/vim/commit/453c19257f6d97904ec2e3823e88e63c983f2f9a
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Oct 26 14:42:09 2019 +0200
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, https://github.com/vim/vim/issues/5075)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 26 Oct 2019 14:45:03 +0200 |
parents | 3b80bdbdc832 |
children | c0445cb7cfe0 |
line wrap: on
line diff
--- 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