vim-patch:9.1.0504: inner-tag textobject confused about ">" in attributes (#29420)

Problem:  inner-tag textobject confused about ">" in attributes
Solution: Skip over quoted '>' when determining the start position

fixes: vim/vim#15043
closes: vim/vim#15049

ca7f93e6f3

Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2024-06-20 09:57:00 +08:00
committed by GitHub
parent 38a1d41ac0
commit 3317aa2f37
2 changed files with 19 additions and 2 deletions

View File

@@ -1193,13 +1193,18 @@ again:
pos_T end_pos = curwin->w_cursor;
if (!do_include) {
// Exclude the start tag.
// Exclude the start tag,
// but skip over '>' if it appears in quotes
bool in_quotes = false;
curwin->w_cursor = start_pos;
while (inc_cursor() >= 0) {
if (*get_cursor_pos_ptr() == '>') {
p = get_cursor_pos_ptr();
if (*p == '>' && !in_quotes) {
inc_cursor();
start_pos = curwin->w_cursor;
break;
} else if (*p == '"' || *p == '\'') {
in_quotes = !in_quotes;
}
}
curwin->w_cursor = end_pos;