Commit 58a802fa authored by Chris Allegretta's avatar Chris Allegretta
Browse files

Fix for precalc_multicolorinfo: make sure we malloc for all the lines we're precalculating, duh.

New utility func alloc_multidata_if_needed().



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4363 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 9 additions and 2 deletions
+9 -2
......@@ -1676,6 +1676,12 @@ int do_mouse(void)
#endif /* !DISABLE_MOUSE */
#ifdef ENABLE_COLOR
void alloc_multidata_if_needed(filestruct *fileptr)
{
if (!fileptr->multidata)
fileptr->multidata = nmalloc(openfile->syntax->nmultis * sizeof(short));
}
/* Precalculate the multi-line start and end regex info so we can speed up
rendering (with any hope at all...) */
void precalc_multicolorinfo(void)
......@@ -1702,8 +1708,7 @@ void precalc_multicolorinfo(void)
for (fileptr = openfile->fileage; fileptr != NULL; fileptr = fileptr->next) {
int startx = 0;
if (!fileptr->multidata)
fileptr->multidata = nmalloc(openfile->syntax->nmultis * sizeof(short));
alloc_multidata_if_needed(fileptr);
if ((cur_check = time(NULL)) - last_check > 1) {
last_check = cur_check;
......@@ -1744,8 +1749,10 @@ void precalc_multicolorinfo(void)
lines in between and the ends properly */
fileptr->multidata[tmpcolor->id] |= CENDAFTER;
for (fileptr = fileptr->next; fileptr != endptr; fileptr = fileptr->next) {
alloc_multidata_if_needed(fileptr);
fileptr->multidata[tmpcolor->id] = CWHOLELINE;
}
alloc_multidata_if_needed(endptr);
endptr->multidata[tmpcolor->id] |= CBEGINBEFORE;
}
}
......
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