mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 09:26:30 +00:00
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)
453c19257f
This commit is contained in:
@@ -4118,7 +4118,7 @@ current_search(
|
|||||||
|
|
||||||
// put cursor on last character of match
|
// put cursor on last character of match
|
||||||
curwin->w_cursor = end_pos;
|
curwin->w_cursor = end_pos;
|
||||||
if (lt(VIsual, end_pos)) {
|
if (lt(VIsual, end_pos) && forward) {
|
||||||
dec_cursor();
|
dec_cursor();
|
||||||
} else if (VIsual_active && lt(curwin->w_cursor, VIsual)) {
|
} else if (VIsual_active && lt(curwin->w_cursor, VIsual)) {
|
||||||
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
|
||||||
@@ -4147,7 +4147,7 @@ current_search(
|
|||||||
return OK;
|
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,
|
/// If move is true, check from the beginning of the buffer,
|
||||||
/// else from position "cur".
|
/// else from position "cur".
|
||||||
/// "direction" is FORWARD or BACKWARD.
|
/// "direction" is FORWARD or BACKWARD.
|
||||||
|
@@ -149,6 +149,11 @@ func Test_gn_command()
|
|||||||
norm! gg0f7vhhhhgnd
|
norm! gg0f7vhhhhgnd
|
||||||
call assert_equal(['12348'], getline(1,'$'))
|
call assert_equal(['12348'], getline(1,'$'))
|
||||||
sil! %d _
|
sil! %d _
|
||||||
|
call setline('.', ['12345678'])
|
||||||
|
let @/ = '5'
|
||||||
|
norm! gg0f2vf7gNd
|
||||||
|
call assert_equal(['1678'], getline(1,'$'))
|
||||||
|
sil! %d _
|
||||||
|
|
||||||
set wrapscan&vim
|
set wrapscan&vim
|
||||||
set belloff&vim
|
set belloff&vim
|
||||||
|
@@ -68,6 +68,7 @@ NULL
|
|||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const int included_patches[] = {
|
static const int included_patches[] = {
|
||||||
|
2218,
|
||||||
2207,
|
2207,
|
||||||
2173,
|
2173,
|
||||||
1850,
|
1850,
|
||||||
|
Reference in New Issue
Block a user