Adjusting whitespace and comments.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5450 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
Benno Schulenberg 2015-11-29 10:43:10 +00:00
parent 6135e28878
commit 9e22e8b1b5
2 changed files with 20 additions and 23 deletions

View File

@ -2,6 +2,7 @@
* src/color.c (reset_multis): Evaluate correctly whether to reset
the multidata cache. This fixes Savannah bug #46543.
* src/color.c (reset_multis): Reset the multidata a bit less often.
* src/color.c (reset_multis): Adjust whitespace and comments.
2015-11-28 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (main): Allow the user full control over the values of

View File

@ -423,9 +423,9 @@ void reset_multis_for_id(filestruct *fileptr, int num)
fileptr->multidata[num] = -1;
}
/* Reset multi-line strings around a filestruct ptr, trying to be smart
* about stopping. Bool force means: reset everything regardless, useful
* when we don't know how much screen state has changed. */
/* Reset multi-line strings around the filestruct fileptr, trying to be
* smart about stopping. Bool force means: reset everything regardless,
* useful when we don't know how much screen state has changed. */
void reset_multis(filestruct *fileptr, bool force)
{
int nobegin, noend;
@ -436,36 +436,32 @@ void reset_multis(filestruct *fileptr, bool force)
return;
for (; tmpcolor != NULL; tmpcolor = tmpcolor->next) {
/* If it's not a multi-line regex, amscray. */
if (tmpcolor->end == NULL)
continue;
alloc_multidata_if_needed(fileptr);
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);
noend = regexec(tmpcolor->end, fileptr->data, 1, &endmatch, 0);
if (fileptr->multidata[tmpcolor->id] == CWHOLELINE) {
if (nobegin && noend)
if (force == FALSE) {
/* Check whether the multidata still matches the current situation. */
nobegin = regexec(tmpcolor->start, fileptr->data, 1, &startmatch, 0);
noend = regexec(tmpcolor->end, fileptr->data, 1, &endmatch, 0);
if ((fileptr->multidata[tmpcolor->id] == CWHOLELINE ||
fileptr->multidata[tmpcolor->id] == CNONE) &&
nobegin && noend)
continue;
} else if (fileptr->multidata[tmpcolor->id] == CNONE) {
if (nobegin && noend)
continue;
} else if (fileptr->multidata[tmpcolor->id] == CBEGINBEFORE && !noend
&& nobegin)
continue;
else if (fileptr->multidata[tmpcolor->id] == CSTARTENDHERE &&
else if (fileptr->multidata[tmpcolor->id] == CSTARTENDHERE &&
!nobegin && !noend && startmatch.rm_so < endmatch.rm_so)
continue;
else if (fileptr->multidata[tmpcolor->id] == CENDAFTER &&
continue;
else if (fileptr->multidata[tmpcolor->id] == CBEGINBEFORE &&
nobegin && !noend)
continue;
else if (fileptr->multidata[tmpcolor->id] == CENDAFTER &&
!nobegin && noend)
continue;
}
continue;
}
/* If we got here, assume the worst. */
/* If we got here, things have changed. */
reset_multis_for_id(fileptr, tmpcolor->id);
}
}