diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-08-16 21:37:50 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-08-16 21:37:50 +0200 |
commit | b476cb7d8d1a8c02409f110dea8b166aa9334e18 (patch) | |
tree | be7d7dcdb25dc7154f530fcbe4b4a2c3410219b6 | |
parent | 2dfcef4c08a3371e2126504bea00b274f937a840 (diff) |
patch 8.1.0290: "cit" on an empty HTML tag changes the whole tagv8.1.0290
Problem: "cit" on an empty HTML tag changes the whole tag.
Solution: Only adjust the area in Visual mode. (Andy Massimino,
closes #3332)
-rw-r--r-- | src/search.c | 7 | ||||
-rw-r--r-- | src/testdir/test_textobjects.vim | 17 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 23 insertions, 3 deletions
diff --git a/src/search.c b/src/search.c index 66ae647185..a12a1d33c5 100644 --- a/src/search.c +++ b/src/search.c @@ -4106,9 +4106,10 @@ again: } curwin->w_cursor = end_pos; - /* If we now have the same text as before reset "do_include" and try - * again. */ - if (EQUAL_POS(start_pos, old_start) && EQUAL_POS(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 && EQUAL_POS(start_pos, old_start) + && EQUAL_POS(end_pos, old_end)) { do_include = TRUE; curwin->w_cursor = old_start; diff --git a/src/testdir/test_textobjects.vim b/src/testdir/test_textobjects.vim index f02619fc09..6a2f5044cc 100644 --- a/src/testdir/test_textobjects.vim +++ b/src/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)) diff --git a/src/version.c b/src/version.c index 66e79d88c1..279908e043 100644 --- a/src/version.c +++ b/src/version.c @@ -795,6 +795,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 290, +/**/ 289, /**/ 288, |