Index: src/proto.h =================================================================== --- src/proto.h (revision 5225) +++ src/proto.h (working copy) @@ -142,6 +142,8 @@ typedef void (*functionptrtype)(void); +void precalc_multicolorinfo(void); + /* All functions in browser.c. */ #ifndef DISABLE_BROWSER char *do_browser(char *path, DIR *dir); Index: src/color.c =================================================================== --- src/color.c (revision 5225) +++ src/color.c (working copy) @@ -441,11 +441,8 @@ continue; alloc_multidata_if_needed(fileptr); - if (force == TRUE) { - reset_multis_for_id(fileptr, tmpcolor->id); - continue; - } + if (force == FALSE) { /* Figure out where the first begin and end are to determine if * things changed drastically for the precalculated multi values. */ nobegin = regexec(tmpcolor->start, fileptr->data, 1, &startmatch, 0); @@ -456,14 +453,20 @@ } else if (fileptr->multidata[tmpcolor->id] == CNONE) { if (nobegin && noend) continue; - } else if (fileptr->multidata[tmpcolor->id] & CBEGINBEFORE && !noend - && (nobegin || endmatch.rm_eo > startmatch.rm_eo)) { - reset_multis_after(fileptr, tmpcolor->id); + } else if (fileptr->multidata[tmpcolor->id] == CSTARTENDHERE && + !nobegin && !noend && startmatch.rm_so < endmatch.rm_so) { continue; + } else if (fileptr->multidata[tmpcolor->id] == CBEGINBEFORE && nobegin && !noend) { + continue; + } else if (fileptr->multidata[tmpcolor->id] == CENDAFTER && !nobegin && noend) { + continue; } + } /* If we got here, assume the worst. */ - reset_multis_for_id(fileptr, tmpcolor->id); + precalc_multicolorinfo(); + edit_refresh_needed = TRUE; + break; } } Index: src/winio.c =================================================================== --- src/winio.c (revision 5225) +++ src/winio.c (working copy) @@ -2724,7 +2724,6 @@ /* We painted to the end of the line, so * don't bother checking any more * starts. */ - fileptr->multidata[tmpcolor->id] = CENDAFTER; break; } } Index: src/nano.c =================================================================== --- src/nano.c (revision 5225) +++ src/nano.c (working copy) @@ -1880,6 +1880,7 @@ #endif alloc_multidata_if_needed(fileptr); + fileptr->multidata[tmpcolor->id] = 0; if ((cur_check = time(NULL)) - last_check > 1) { last_check = cur_check;