vim-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 vim/vim#7136)
a604ccc959

Use 'const char*' for spat,mpat,epat params of do_searchpair()
to reduce (char_u *) casts.

Cherry-pick Test_string_html_objects() changes from patch 8.2.0655.
This commit is contained in:
Jan Edmund Lazo
2020-10-15 19:04:25 -04:00
parent 3566244d0e
commit f319e4608e
3 changed files with 48 additions and 17 deletions

View File

@@ -7668,7 +7668,7 @@ static int searchpair_cmn(typval_T *argvars, pos_T *match_pos)
}
retval = do_searchpair(
(char_u *)spat, (char_u *)mpat, (char_u *)epat, dir, skip,
spat, mpat, epat, dir, skip,
flags, match_pos, lnum_stop, time_limit);
theend:
@@ -7712,9 +7712,9 @@ static void f_searchpairpos(typval_T *argvars, typval_T *rettv, FunPtr fptr)
*/
long
do_searchpair(
char_u *spat, // start pattern
char_u *mpat, // middle pattern
char_u *epat, // end pattern
const char *spat, // start pattern
const char *mpat, // middle pattern
const char *epat, // end pattern
int dir, // BACKWARD or FORWARD
const typval_T *skip, // skip expression
int flags, // SP_SETPCMARK and other SP_ values
@@ -7722,6 +7722,7 @@ do_searchpair(
linenr_T lnum_stop, // stop at this line if not zero
long time_limit // stop after this many msec
)
FUNC_ATTR_NONNULL_ARG(1, 2, 3)
{
char_u *save_cpo;
char_u *pat, *pat2 = NULL, *pat3 = NULL;
@@ -7736,8 +7737,6 @@ do_searchpair(
bool use_skip = false;
int options = SEARCH_KEEP;
proftime_T tm;
size_t pat2_len;
size_t pat3_len;
// Make 'cpoptions' empty, the 'l' flag should not be used here.
save_cpo = p_cpo;
@@ -7748,9 +7747,9 @@ do_searchpair(
// Make two search patterns: start/end (pat2, for in nested pairs) and
// start/middle/end (pat3, for the top pair).
pat2_len = STRLEN(spat) + STRLEN(epat) + 17;
const size_t pat2_len = strlen(spat) + strlen(epat) + 17;
pat2 = xmalloc(pat2_len);
pat3_len = STRLEN(spat) + STRLEN(mpat) + STRLEN(epat) + 25;
const size_t pat3_len = strlen(spat) + strlen(mpat) + strlen(epat) + 25;
pat3 = xmalloc(pat3_len);
snprintf((char *)pat2, pat2_len, "\\m\\(%s\\m\\)\\|\\(%s\\m\\)", spat, epat);
if (*mpat == NUL) {