diff options
author | Jaehwang Jerry Jung <tomtomjhj@gmail.com> | 2019-10-26 22:32:25 +0900 |
---|---|---|
committer | Jaehwang Jerry Jung <tomtomjhj@gmail.com> | 2019-10-27 03:35:19 +0900 |
commit | 6dcc1d100572b462f75f64f7e98a0b5d80144cba (patch) | |
tree | f99b75f48a1a9170022df8ce70f7f69f20f8935f /src | |
parent | c26466ae8b20a0a1a57935c712c2ebbca73bb35b (diff) | |
download | rneovim-6dcc1d100572b462f75f64f7e98a0b5d80144cba.tar.gz rneovim-6dcc1d100572b462f75f64f7e98a0b5d80144cba.tar.bz2 rneovim-6dcc1d100572b462f75f64f7e98a0b5d80144cba.zip |
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, vim/vim#5075)
https://github.com/vim/vim/commit/453c19257f6d97904ec2e3823e88e63c983f2f9a
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/search.c | 4 | ||||
-rw-r--r-- | src/nvim/testdir/test_gn.vim | 5 | ||||
-rw-r--r-- | src/nvim/version.c | 1 |
3 files changed, 8 insertions, 2 deletions
diff --git a/src/nvim/search.c b/src/nvim/search.c index 893b5f7d89..c4c8633ed9 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -4118,7 +4118,7 @@ current_search( // put cursor on last character of match curwin->w_cursor = end_pos; - if (lt(VIsual, end_pos)) { + if (lt(VIsual, end_pos) && forward) { dec_cursor(); } else if (VIsual_active && lt(curwin->w_cursor, VIsual)) { curwin->w_cursor = pos; // put the cursor on the start of the match @@ -4147,7 +4147,7 @@ current_search( return OK; } -/// 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. diff --git a/src/nvim/testdir/test_gn.vim b/src/nvim/testdir/test_gn.vim index 77c5e8ecd5..834397126f 100644 --- a/src/nvim/testdir/test_gn.vim +++ b/src/nvim/testdir/test_gn.vim @@ -149,6 +149,11 @@ func Test_gn_command() norm! gg0f7vhhhhgnd call assert_equal(['12348'], getline(1,'$')) sil! %d _ + call setline('.', ['12345678']) + let @/ = '5' + norm! gg0f2vf7gNd + call assert_equal(['1678'], getline(1,'$')) + sil! %d _ set wrapscan&vim set belloff&vim diff --git a/src/nvim/version.c b/src/nvim/version.c index 7cb2334012..db02279fa3 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -68,6 +68,7 @@ NULL // clang-format off static const int included_patches[] = { + 2218, 2207, 2173, 1850, |