From: Bram Moolenaar Date: Sun, 17 Nov 2019 16:32:28 +0000 (+0100) Subject: patch 8.1.2314: vi' sometimes does not select anything X-Git-Tag: v8.1.2314 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7170b295b06e3168424985530d8477ed2e058b67;p=thirdparty%2Fvim.git 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) --- diff --git a/src/search.c b/src/search.c index cff289cf50..f7c7eca38f 100644 --- a/src/search.c +++ b/src/search.c @@ -4434,9 +4434,10 @@ current_quote( return FALSE; vis_bef_curs = LT_POS(VIsual, curwin->w_cursor); + vis_empty = EQUAL_POS(VIsual, curwin->w_cursor); if (*p_sel == 'e') { - if (!vis_bef_curs) + if (!vis_bef_curs && !vis_empty) { // VIsual needs to be the start of Visual selection. pos_T t = curwin->w_cursor; @@ -4447,8 +4448,8 @@ current_quote( restore_vis_bef = TRUE; } dec_cursor(); + vis_empty = EQUAL_POS(VIsual, curwin->w_cursor); } - vis_empty = EQUAL_POS(VIsual, curwin->w_cursor); } if (!vis_empty) diff --git a/src/testdir/test_textobjects.vim b/src/testdir/test_textobjects.vim index a3e3851f42..5702a6ad8a 100644 --- a/src/testdir/test_textobjects.vim +++ b/src/testdir/test_textobjects.vim @@ -47,6 +47,9 @@ func Test_quote_selection_selection_exclusive() set selection=exclusive exe "norm! fdvhi'y" call assert_equal('bcde', @") + let @"='dummy' + exe "norm! $gevi'y" + call assert_equal('bcde', @") set selection&vim bw! endfunc diff --git a/src/version.c b/src/version.c index cfd58460a8..8422b71e39 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2314, /**/ 2313, /**/