1
1

tweaks: make a skipping condition more precise

A step forward needs to be forced not when both start match and
end match have zero length, but when the "full match" (all text
from the start of the start match to the end of the end match)
covers zero bytes.  In other words: the start and end match are
both of zero length AND are at the same spot.
Этот коммит содержится в:
Benno Schulenberg 2021-02-16 16:11:02 +01:00
родитель f0cc59bead
Коммит 764ab96bda

Просмотреть файл

@ -326,15 +326,17 @@ void precalc_multicolorinfo(void)
if (regexec(ink->end, line->data + index, 1,
&endmatch, (index == 0) ? 0 : REG_NOTBOL) == 0) {
line->multidata[ink->id] = JUSTONTHIS;
index += endmatch.rm_eo;
/* If both start and end are mere anchors, step ahead. */
if (startmatch.rm_so == startmatch.rm_eo &&
endmatch.rm_so == endmatch.rm_eo) {
/* When at end-of-line, we're done. */
/* If the total match has zero length, force an advance. */
if (startmatch.rm_eo - startmatch.rm_so + endmatch.rm_eo == 0) {
/* When at end-of-line, there is no other start. */
if (line->data[index] == '\0')
break;
index = step_right(line->data, index);
}
continue;
}