From a604ccc959c3bff88d3d5bc3c965819fc326d239 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 15 Oct 2020 21:23:28 +0200 Subject: patch 8.2.1850: "vat" does not select tags correctly over line break Problem: "vat" does not select tags correctly over line break. Solution: Adjust the search pattern. (Aufar Gilbran, closes #7136) --- src/testdir/test_textobjects.vim | 12 ++++++++++++ src/textobject.c | 4 ++-- src/version.c | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/testdir/test_textobjects.vim b/src/testdir/test_textobjects.vim index 54de3f89dc..c691c8be68 100644 --- a/src/testdir/test_textobjects.vim +++ b/src/testdir/test_textobjects.vim @@ -169,6 +169,18 @@ func Test_string_html_objects() normal! k$vaty call assert_equal("\nwelcome\n</html>", @") + " nested tag that has < in a different line from > + let t = "<div><div\n></div></div>" + $put =t + normal! k0vaty + call assert_equal("<div><div\n></div></div>", @") + + " nested tag with attribute that has < in a different line from > + let t = "<div><div\nattr=\"attr\"\n></div></div>" + $put =t + normal! 2k0vaty + call assert_equal("<div><div\nattr=\"attr\"\n></div></div>", @") + set quoteescape& enew! endfunc diff --git a/src/textobject.c b/src/textobject.c index 23bdc96660..2d5d5ddfbc 100644 --- a/src/textobject.c +++ b/src/textobject.c @@ -1347,7 +1347,7 @@ again: curwin->w_cursor = old_pos; goto theend; } - spat = alloc(len + 31); + spat = alloc(len + 39); epat = alloc(len + 9); if (spat == NULL || epat == NULL) { @@ -1356,7 +1356,7 @@ again: curwin->w_cursor = old_pos; goto theend; } - sprintf((char *)spat, "<%.*s\\>\\%%(\\s\\_[^>]\\{-}[^/]>\\|>\\)\\c", len, p); + sprintf((char *)spat, "<%.*s\\>\\%%(\\_s\\_[^>]\\{-}\\_[^/]>\\|\\_s\\?>\\)\\c", len, p); sprintf((char *)epat, "</%.*s>\\c", len, p); r = do_searchpair(spat, (char_u *)"", epat, FORWARD, NULL, diff --git a/src/version.c b/src/version.c index 8ea210a133..a2d8221ca3 100644 --- a/src/version.c +++ b/src/version.c @@ -750,6 +750,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1850, /**/ 1849, /**/ -- cgit v1.2.3