changeset 18644:7bfe68b637be v8.1.2314

patch 8.1.2314: vi' sometimes does not select anything Commit: https://github.com/vim/vim/commit/7170b295b06e3168424985530d8477ed2e058b67 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Nov 17 17:32:28 2019 +0100 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 https://github.com/vim/vim/issues/5183)
author Bram Moolenaar <Bram@vim.org>
date Sun, 17 Nov 2019 17:45:03 +0100
parents 31ba6c846789
children d07c730f4fd2
files src/search.c src/testdir/test_textobjects.vim src/version.c
diffstat 3 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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)
--- a/src/testdir/test_textobjects.vim
+++ b/src/testdir/test_textobjects.vim
@@ -47,6 +47,9 @@ func Test_quote_selection_selection_excl
   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
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2314,
+/**/
     2313,
 /**/
     2312,