aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/search.c8
-rw-r--r--src/nvim/testdir/test_textobjects.vim17
2 files changed, 22 insertions, 3 deletions
diff --git a/src/nvim/search.c b/src/nvim/search.c
index b58707a3c1..7a4b585a93 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -3445,9 +3445,11 @@ again:
}
curwin->w_cursor = end_pos;
- /* If we now have the same text as before reset "do_include" and try
- * again. */
- if (equalpos(start_pos, old_start) && equalpos(end_pos, old_end)) {
+ // If we are in Visual mode and now have the same text as before set
+ // "do_include" and try again.
+ if (VIsual_active
+ && equalpos(start_pos, old_start)
+ && equalpos(end_pos, old_end)) {
do_include = TRUE;
curwin->w_cursor = old_start;
count = count_arg;
diff --git a/src/nvim/testdir/test_textobjects.vim b/src/nvim/testdir/test_textobjects.vim
index 17602fbe26..52c0c3698e 100644
--- a/src/nvim/testdir/test_textobjects.vim
+++ b/src/nvim/testdir/test_textobjects.vim
@@ -121,6 +121,23 @@ func Test_string_html_objects()
enew!
endfunc
+func Test_empty_html_tag()
+ new
+ call setline(1, '<div></div>')
+ normal 0citxxx
+ call assert_equal('<div>xxx</div>', getline(1))
+
+ call setline(1, '<div></div>')
+ normal 0f<cityyy
+ call assert_equal('<div>yyy</div>', getline(1))
+
+ call setline(1, '<div></div>')
+ normal 0f<vitsaaa
+ call assert_equal('aaa', getline(1))
+
+ bwipe!
+endfunc
+
" Tests for match() and matchstr()
func Test_match()
call assert_equal("b", matchstr("abcd", ".", 0, 2))