tweaks: slightly speed up the change detection for multiline matches

master
Benno Schulenberg 2017-01-21 19:55:05 +01:00
parent 1d10d79860
commit a8a70f0f29
1 changed files with 14 additions and 13 deletions

View File

@ -354,19 +354,20 @@ void reset_multis(filestruct *fileptr, bool force)
/* Check whether the multidata still matches the current situation. */ /* Check whether the multidata still matches the current situation. */
nobegin = regexec(ink->start, fileptr->data, 1, &startmatch, 0); nobegin = regexec(ink->start, fileptr->data, 1, &startmatch, 0);
noend = regexec(ink->end, fileptr->data, 1, &endmatch, 0); noend = regexec(ink->end, fileptr->data, 1, &endmatch, 0);
if ((fileptr->multidata[ink->id] == CWHOLELINE || if (fileptr->multidata[ink->id] == CNONE ||
fileptr->multidata[ink->id] == CNONE) && fileptr->multidata[ink->id] == CWHOLELINE) {
nobegin && noend) if (nobegin && noend)
continue; continue;
else if (fileptr->multidata[ink->id] == CSTARTENDHERE && } else if (fileptr->multidata[ink->id] == CSTARTENDHERE) {
!nobegin && !noend && startmatch.rm_so < endmatch.rm_so) if (!nobegin && !noend && startmatch.rm_so < endmatch.rm_so)
continue; continue;
else if (fileptr->multidata[ink->id] == CBEGINBEFORE && } else if (fileptr->multidata[ink->id] == CBEGINBEFORE) {
nobegin && !noend) if (nobegin && !noend)
continue; continue;
else if (fileptr->multidata[ink->id] == CENDAFTER && } else if (fileptr->multidata[ink->id] == CENDAFTER) {
!nobegin && noend) if (!nobegin && noend)
continue; continue;
}
} }
/* If we got here, things have changed. */ /* If we got here, things have changed. */