diff --git a/ChangeLog b/ChangeLog index 6ca20208..17d9bbfa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-01-09 Benno Schulenberg + * src/color.c (precalc_multicolorinfo), src/winio.c (edit_draw): + Make sure to keep advancing also when matches are zero-length. + This fixes Savannah bug #26977 reported by Tigrmesh. + 2016-01-07 Benno Schulenberg * src/global.c (assign_keyinfo): Delete two unneeded #ifdefs: if they /could/ be false, the H and E keys would stop working. diff --git a/src/color.c b/src/color.c index dd93bd7e..849e26e4 100644 --- a/src/color.c +++ b/src/color.c @@ -527,6 +527,10 @@ void precalc_multicolorinfo(void) if (regexec(tmpcolor->end, &fileptr->data[startx], 1, &endmatch, (startx == 0) ? 0 : REG_NOTBOL) == 0) { startx += endmatch.rm_eo; + /* Step ahead when both start and end are mere anchors. */ + if (startmatch.rm_so == startmatch.rm_eo && + endmatch.rm_so == endmatch.rm_eo) + startx += 1; fileptr->multidata[tmpcolor->id] = CSTARTENDHERE; #ifdef DEBUG fprintf(stderr, "end found on this line\n"); diff --git a/src/winio.c b/src/winio.c index eae0276d..06d8889f 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2611,6 +2611,9 @@ void edit_draw(filestruct *fileptr, const char *converted, int } } start_col = endmatch.rm_eo; + /* Skip over a zero-length match. */ + if (endmatch.rm_so == endmatch.rm_eo) + start_col += 1; } else { /* There is no end on this line. But we haven't yet * looked for one on later lines. */