Commit ba8f8067 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

Fusing three functions into a single one.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5477 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 29 additions and 37 deletions
+29 -37
2015-12-03 Benno Schulenberg <bensberg@justemail.net> 2015-12-03 Benno Schulenberg <bensberg@justemail.net>
* src/proto.h: Avoid a compilation warning. * src/proto.h: Avoid a compilation warning.
* src/color.c (reset_multis_for_id, reset_multis_before/after):
Fuse these three functions into a single one.
2015-12-03 Benno Schulenberg <bensberg@justemail.net> 2015-12-03 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (discard_until): Move the trimming of the undo stack * src/text.c (discard_until): Move the trimming of the undo stack
......
...@@ -365,54 +365,44 @@ void color_update(void) ...@@ -365,54 +365,44 @@ void color_update(void)
} }
} }
/* Reset the multicolor info cache for records for any lines which need /* Reset the multiline coloring cache for one specific regex (given by
* to be recalculated. */ * index) for lines that need reevaluation. */
void reset_multis_after(filestruct *fileptr, int mindex) void reset_multis_for_id(filestruct *fileptr, int index)
{ {
filestruct *oof; filestruct *row;
for (oof = fileptr->next; oof != NULL; oof = oof->next) {
alloc_multidata_if_needed(oof); /* Reset the cache of earlier lines, as far back as needed. */
if (oof->multidata[mindex] != CNONE) for (row = fileptr->prev; row != NULL; row = row->prev) {
oof->multidata[mindex] = -1; alloc_multidata_if_needed(row);
else if (row->multidata[index] == CNONE)
break; break;
row->multidata[index] = -1;
} }
for (; oof != NULL; oof = oof->next) { for (; row != NULL; row = row->prev) {
alloc_multidata_if_needed(oof); alloc_multidata_if_needed(row);
if (oof->multidata[mindex] == CNONE) if (row->multidata[index] != CNONE)
oof->multidata[mindex] = -1;
else
break; break;
row->multidata[index] = -1;
} }
edit_refresh_needed = TRUE;
}
void reset_multis_before(filestruct *fileptr, int mindex) /* Reset the cache of the current line. */
{ fileptr->multidata[index] = -1;
filestruct *oof;
for (oof = fileptr->prev; oof != NULL; oof = oof->prev) { /* Reset the cache of later lines, as far ahead as needed. */
alloc_multidata_if_needed(oof); for (row = fileptr->next; row != NULL; row = row->next) {
if (oof->multidata[mindex] != CNONE) alloc_multidata_if_needed(row);
oof->multidata[mindex] = -1; if (row->multidata[index] == CNONE)
else
break; break;
row->multidata[index] = -1;
} }
for (; oof != NULL; oof = oof->prev) { for (; row != NULL; row = row->next) {
alloc_multidata_if_needed(oof); alloc_multidata_if_needed(row);
if (oof->multidata[mindex] == CNONE) if (row->multidata[index] != CNONE)
oof->multidata[mindex] = -1;
else
break; break;
row->multidata[index] = -1;
} }
edit_refresh_needed = TRUE;
}
/* Reset one multiline regex info. */ edit_refresh_needed = TRUE;
void reset_multis_for_id(filestruct *fileptr, int num)
{
reset_multis_before(fileptr, num);
reset_multis_after(fileptr, num);
fileptr->multidata[num] = -1;
} }
/* Reset multi-line strings around the filestruct fileptr, trying to be /* Reset multi-line strings around the filestruct fileptr, trying to be
......
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