# HG changeset patch # User Christian Brabandt # Date 1534448705 -7200 # Node ID e7f92d1a3fcdb9deedb22183829c2ada38efb7b6 # Parent 8e7e7fa5b79be5a3a4163569eddfb8ae2e8e306b patch 8.1.0290: "cit" on an empty HTML tag changes the whole tag commit https://github.com/vim/vim/commit/b476cb7d8d1a8c02409f110dea8b166aa9334e18 Author: Bram Moolenaar Date: Thu Aug 16 21:37:50 2018 +0200 patch 8.1.0290: "cit" on an empty HTML tag changes the whole tag Problem: "cit" on an empty HTML tag changes the whole tag. Solution: Only adjust the area in Visual mode. (Andy Massimino, closes #3332) diff --git a/src/search.c b/src/search.c --- 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 --- 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, '
') + normal 0citxxx + call assert_equal('
xxx
', getline(1)) + + call setline(1, '
') + normal 0fyyy', getline(1)) + + call setline(1, '
') + normal 0f