]> granicus.if.org Git - vim/commitdiff
patch 8.2.1850: "vat" does not select tags correctly over line break v8.2.1850
authorBram Moolenaar <Bram@vim.org>
Thu, 15 Oct 2020 19:23:28 +0000 (21:23 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 15 Oct 2020 19:23:28 +0000 (21:23 +0200)
Problem:    "vat" does not select tags correctly over line break.
Solution:   Adjust the search pattern. (Aufar Gilbran, closes #7136)

src/testdir/test_textobjects.vim
src/textobject.c
src/version.c

index 54de3f89dce51cc28de957e30c47c6d3cf0ed2ab..c691c8be68960147a12a4896505cba46f940925e 100644 (file)
@@ -169,6 +169,18 @@ func Test_string_html_objects()
   normal! k$vaty
   call assert_equal("<html>\n<title>welcome\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
index 23bdc966605c39a1e8cb3727ed8f3929586b127b..2d5d5ddfbc00d29c9c3a026e38e9c62be070348d 100644 (file)
@@ -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,
index 8ea210a13371ad1b89b4195e0b486d37023ac43d..a2d8221ca3e31948966e243c54e282bcd9472eea 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1850,
 /**/
     1849,
 /**/