mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
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:
@@ -4677,7 +4677,7 @@ abort_search:
|
|||||||
#endif /* FEAT_TEXTOBJ */
|
#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
|
* If move is TRUE, check from the beginning of the buffer, else from position
|
||||||
* "cur".
|
* "cur".
|
||||||
* "direction" is FORWARD or BACKWARD.
|
* "direction" is FORWARD or BACKWARD.
|
||||||
@@ -4851,7 +4851,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_POS(VIsual, end_pos))
|
if (LT_POS(VIsual, end_pos) && forward)
|
||||||
dec_cursor();
|
dec_cursor();
|
||||||
else if (VIsual_active && LT_POS(curwin->w_cursor, VIsual))
|
else if (VIsual_active && LT_POS(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
|
||||||
|
@@ -148,6 +148,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
|
||||||
endfu
|
endfu
|
||||||
|
@@ -741,6 +741,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2218,
|
||||||
/**/
|
/**/
|
||||||
2217,
|
2217,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user