]> granicus.if.org Git - vim/commitdiff
patch 8.1.2314: vi' sometimes does not select anything v8.1.2314
authorBram Moolenaar <Bram@vim.org>
Sun, 17 Nov 2019 16:32:28 +0000 (17:32 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 17 Nov 2019 16:32:28 +0000 (17:32 +0100)
Problem:    vi' sometimes does not select anything.
Solution:   Recognize an empty selection. (Christian Brabandt, closes #5183)

src/search.c
src/testdir/test_textobjects.vim
src/version.c

index cff289cf5063218678fce1abd8d03736a1083d9e..f7c7eca38fcb5adb1107b721edbe31f13719d62d 100644 (file)
@@ -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)
index a3e3851f422dc4280f9f3c17ad5e38a4e52015c3..5702a6ad8ad012d0c4bcdb3423477543682b822f 100644 (file)
@@ -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
index cfd58460a892254905e94b172cfd2e930cb94dc5..8422b71e394d3678359017649cad9a959b557d9e 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2314,
 /**/
     2313,
 /**/