Skip to content

Commit 7170b29

Browse files
committed
patch 8.1.2314: vi' sometimes does not select anything
Problem: vi' sometimes does not select anything. Solution: Recognize an empty selection. (Christian Brabandt, closes #5183)
1 parent eda1da0 commit 7170b29

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/search.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4434,9 +4434,10 @@ current_quote(
44344434
return FALSE;
44354435

44364436
vis_bef_curs = LT_POS(VIsual, curwin->w_cursor);
4437+
vis_empty = EQUAL_POS(VIsual, curwin->w_cursor);
44374438
if (*p_sel == 'e')
44384439
{
4439-
if (!vis_bef_curs)
4440+
if (!vis_bef_curs && !vis_empty)
44404441
{
44414442
// VIsual needs to be the start of Visual selection.
44424443
pos_T t = curwin->w_cursor;
@@ -4447,8 +4448,8 @@ current_quote(
44474448
restore_vis_bef = TRUE;
44484449
}
44494450
dec_cursor();
4451+
vis_empty = EQUAL_POS(VIsual, curwin->w_cursor);
44504452
}
4451-
vis_empty = EQUAL_POS(VIsual, curwin->w_cursor);
44524453
}
44534454

44544455
if (!vis_empty)

src/testdir/test_textobjects.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ func Test_quote_selection_selection_exclusive()
4747
set selection=exclusive
4848
exe "norm! fdvhi'y"
4949
call assert_equal('bcde', @")
50+
let @"='dummy'
51+
exe "norm! $gevi'y"
52+
call assert_equal('bcde', @")
5053
set selection&vim
5154
bw!
5255
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,8 @@ static char *(features[]) =
741741

742742
static int included_patches[] =
743743
{ /* Add new patch number below this line */
744+
/**/
745+
2314,
744746
/**/
745747
2313,
746748
/**/

0 commit comments

Comments
 (0)