Commit 9e22e8b1 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

Adjusting whitespace and comments.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5450 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 20 additions and 23 deletions
+20 -23
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* src/color.c (reset_multis): Evaluate correctly whether to reset * src/color.c (reset_multis): Evaluate correctly whether to reset
the multidata cache. This fixes Savannah bug #46543. 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): Reset the multidata a bit less often.
* src/color.c (reset_multis): Adjust whitespace and comments.
2015-11-28 Benno Schulenberg <bensberg@justemail.net> 2015-11-28 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (main): Allow the user full control over the values of * src/nano.c (main): Allow the user full control over the values of
......
...@@ -423,9 +423,9 @@ void reset_multis_for_id(filestruct *fileptr, int num) ...@@ -423,9 +423,9 @@ void reset_multis_for_id(filestruct *fileptr, int num)
fileptr->multidata[num] = -1; fileptr->multidata[num] = -1;
} }
/* Reset multi-line strings around a filestruct ptr, trying to be smart /* Reset multi-line strings around the filestruct fileptr, trying to be
* about stopping. Bool force means: reset everything regardless, useful * smart about stopping. Bool force means: reset everything regardless,
* when we don't know how much screen state has changed. */ * useful when we don't know how much screen state has changed. */
void reset_multis(filestruct *fileptr, bool force) void reset_multis(filestruct *fileptr, bool force)
{ {
int nobegin, noend; int nobegin, noend;
...@@ -436,36 +436,32 @@ void reset_multis(filestruct *fileptr, bool force) ...@@ -436,36 +436,32 @@ void reset_multis(filestruct *fileptr, bool force)
return; return;
for (; tmpcolor != NULL; tmpcolor = tmpcolor->next) { for (; tmpcolor != NULL; tmpcolor = tmpcolor->next) {
/* If it's not a multi-line regex, amscray. */ /* If it's not a multi-line regex, amscray. */
if (tmpcolor->end == NULL) if (tmpcolor->end == NULL)
continue; continue;
alloc_multidata_if_needed(fileptr); alloc_multidata_if_needed(fileptr);
if (force == FALSE) { if (force == FALSE) {
/* Figure out where the first begin and end are to determine if /* Check whether the multidata still matches the current situation. */
* things changed drastically for the precalculated multi values. */ nobegin = regexec(tmpcolor->start, fileptr->data, 1, &startmatch, 0);
nobegin = regexec(tmpcolor->start, fileptr->data, 1, &startmatch, 0); noend = regexec(tmpcolor->end, fileptr->data, 1, &endmatch, 0);
noend = regexec(tmpcolor->end, fileptr->data, 1, &endmatch, 0); if ((fileptr->multidata[tmpcolor->id] == CWHOLELINE ||
if (fileptr->multidata[tmpcolor->id] == CWHOLELINE) { fileptr->multidata[tmpcolor->id] == CNONE) &&
if (nobegin && noend) nobegin && noend)
continue;
} else if (fileptr->multidata[tmpcolor->id] == CNONE) {
if (nobegin && noend)
continue; continue;
} else if (fileptr->multidata[tmpcolor->id] == CBEGINBEFORE && !noend else if (fileptr->multidata[tmpcolor->id] == CSTARTENDHERE &&
&& nobegin)
continue;
else if (fileptr->multidata[tmpcolor->id] == CSTARTENDHERE &&
!nobegin && !noend && startmatch.rm_so < endmatch.rm_so) !nobegin && !noend && startmatch.rm_so < endmatch.rm_so)
continue; continue;
else if (fileptr->multidata[tmpcolor->id] == CENDAFTER && else if (fileptr->multidata[tmpcolor->id] == CBEGINBEFORE &&
nobegin && !noend)
continue;
else if (fileptr->multidata[tmpcolor->id] == CENDAFTER &&
!nobegin && noend) !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); reset_multis_for_id(fileptr, tmpcolor->id);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment