summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-11-17 17:32:28 +0100
committerBram Moolenaar <Bram@vim.org>2019-11-17 17:32:28 +0100
commit7170b295b06e3168424985530d8477ed2e058b67 (patch)
treea2041e4732fd89270917ce010c300f3897b49411
parenteda1da0c9a8db1400649629117e7d248c07735f7 (diff)
downloadvim-git-7170b295b06e3168424985530d8477ed2e058b67.tar.gz
patch 8.1.2314: vi' sometimes does not select anythingv8.1.2314
Problem: vi' sometimes does not select anything. Solution: Recognize an empty selection. (Christian Brabandt, closes #5183)
-rw-r--r--src/search.c5
-rw-r--r--src/testdir/test_textobjects.vim3
-rw-r--r--src/version.c2
3 files changed, 8 insertions, 2 deletions
diff --git a/src/search.c b/src/search.c
index cff289cf5..f7c7eca38 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 a3e3851f4..5702a6ad8 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 cfd58460a..8422b71e3 100644
--- 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,