vim-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 vim/vim#5183)
7170b295b0
This commit is contained in:
Jan Edmund Lazo
2019-11-17 21:48:59 -05:00
parent e4b185893f
commit f484d3b2d4
2 changed files with 6 additions and 2 deletions

View File

@@ -3808,8 +3808,9 @@ current_quote(
} }
vis_bef_curs = lt(VIsual, curwin->w_cursor); vis_bef_curs = lt(VIsual, curwin->w_cursor);
vis_empty = equalpos(VIsual, curwin->w_cursor);
if (*p_sel == 'e') { if (*p_sel == 'e') {
if (!vis_bef_curs) { if (!vis_bef_curs && !vis_empty) {
// VIsual needs to be start of Visual selection. // VIsual needs to be start of Visual selection.
pos_T t = curwin->w_cursor; pos_T t = curwin->w_cursor;
@@ -3819,9 +3820,9 @@ current_quote(
restore_vis_bef = true; restore_vis_bef = true;
} }
dec_cursor(); dec_cursor();
}
vis_empty = equalpos(VIsual, curwin->w_cursor); vis_empty = equalpos(VIsual, curwin->w_cursor);
} }
}
if (!vis_empty) { if (!vis_empty) {
/* Check if the existing selection exactly spans the text inside /* Check if the existing selection exactly spans the text inside

View File

@@ -48,6 +48,9 @@ func Test_quote_selection_selection_exclusive()
set selection=exclusive set selection=exclusive
exe "norm! fdvhi'y" exe "norm! fdvhi'y"
call assert_equal('bcde', @") call assert_equal('bcde', @")
let @"='dummy'
exe "norm! $gevi'y"
call assert_equal('bcde', @")
set selection&vim set selection&vim
bw! bw!
endfunc endfunc