mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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:
parent
38a1d41ac0
commit
3317aa2f37
@ -1193,13 +1193,18 @@ again:
|
|||||||
pos_T end_pos = curwin->w_cursor;
|
pos_T end_pos = curwin->w_cursor;
|
||||||
|
|
||||||
if (!do_include) {
|
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;
|
curwin->w_cursor = start_pos;
|
||||||
while (inc_cursor() >= 0) {
|
while (inc_cursor() >= 0) {
|
||||||
if (*get_cursor_pos_ptr() == '>') {
|
p = get_cursor_pos_ptr();
|
||||||
|
if (*p == '>' && !in_quotes) {
|
||||||
inc_cursor();
|
inc_cursor();
|
||||||
start_pos = curwin->w_cursor;
|
start_pos = curwin->w_cursor;
|
||||||
break;
|
break;
|
||||||
|
} else if (*p == '"' || *p == '\'') {
|
||||||
|
in_quotes = !in_quotes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
curwin->w_cursor = end_pos;
|
curwin->w_cursor = end_pos;
|
||||||
|
@ -203,6 +203,18 @@ func Test_string_html_objects()
|
|||||||
normal! 2k0vaty
|
normal! 2k0vaty
|
||||||
call assert_equal("<div><div\nattr=\"attr\"\n></div></div>", @", e)
|
call assert_equal("<div><div\nattr=\"attr\"\n></div></div>", @", e)
|
||||||
|
|
||||||
|
" tag, that includes a > in some attribute
|
||||||
|
let t = "<div attr=\"attr >> foo >> bar \">Hello</div>"
|
||||||
|
$put =t
|
||||||
|
normal! fHyit
|
||||||
|
call assert_equal("Hello", @", e)
|
||||||
|
|
||||||
|
" tag, that includes a > in some attribute
|
||||||
|
let t = "<div attr='attr >> foo >> bar '>Hello 123</div>"
|
||||||
|
$put =t
|
||||||
|
normal! fHyit
|
||||||
|
call assert_equal("Hello 123", @", e)
|
||||||
|
|
||||||
set quoteescape&
|
set quoteescape&
|
||||||
|
|
||||||
" this was going beyond the end of the line
|
" this was going beyond the end of the line
|
||||||
|
Loading…
Reference in New Issue
Block a user