From f484d3b2d4ec7f3a0c18c46125021aceedec03af Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 17 Nov 2019 21:48:59 -0500 Subject: 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) https://github.com/vim/vim/commit/7170b295b06e3168424985530d8477ed2e058b67 --- src/nvim/search.c | 5 +++-- src/nvim/testdir/test_textobjects.vim | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/search.c b/src/nvim/search.c index d396e7551b..a298f7333e 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -3808,8 +3808,9 @@ current_quote( } vis_bef_curs = lt(VIsual, curwin->w_cursor); + vis_empty = equalpos(VIsual, curwin->w_cursor); if (*p_sel == 'e') { - if (!vis_bef_curs) { + if (!vis_bef_curs && !vis_empty) { // VIsual needs to be start of Visual selection. pos_T t = curwin->w_cursor; @@ -3819,8 +3820,8 @@ current_quote( restore_vis_bef = true; } dec_cursor(); + vis_empty = equalpos(VIsual, curwin->w_cursor); } - vis_empty = equalpos(VIsual, curwin->w_cursor); } if (!vis_empty) { diff --git a/src/nvim/testdir/test_textobjects.vim b/src/nvim/testdir/test_textobjects.vim index 9194e0014d..448b2dc51c 100644 --- a/src/nvim/testdir/test_textobjects.vim +++ b/src/nvim/testdir/test_textobjects.vim @@ -48,6 +48,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 -- cgit