diff --git a/ChangeLog b/ChangeLog index c9169455ffaf320e2d6e69c275546e0206457ec7..e8f21d802c4eee59d71e861eed80d1350cc65b79 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ * src/winio.c (edit_draw): When an end is found but nothing is painted (because the coloured part is horizontally scrolled off), nevertheless set the multidata to CBEGINBEFORE. This fixes Savannah bug #46545. + * src/winio.c (edit_draw): Use the main cache-allocation routine. 2015-11-28 Benno Schulenberg <bensberg@justemail.net> * src/nano.c (main): Allow the user full control over the values of diff --git a/src/winio.c b/src/winio.c index 93f868b817bb4b51e4eea9e8cf98ea3afb2891ae..473b09a4adbd94e6cea09f607dce63e54d52fa5f 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2481,16 +2481,10 @@ void edit_draw(filestruct *fileptr, const char *converted, int if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) { const colortype *tmpcolor = openfile->colorstrings; - /* Set up multi-line color data for this line if it's not yet - * calculated. */ - if (fileptr->multidata == NULL && openfile->syntax - && openfile->syntax->nmultis > 0) { - int i; - fileptr->multidata = (short *)nmalloc(openfile->syntax->nmultis * sizeof(short)); - for (i = 0; i < openfile->syntax->nmultis; i++) - /* Assume this applies until we know otherwise. */ - fileptr->multidata[i] = -1; - } + /* If there are multiline regexes, make sure there is a cache. */ + if (openfile->syntax->nmultis > 0) + alloc_multidata_if_needed(fileptr); + for (; tmpcolor != NULL; tmpcolor = tmpcolor->next) { int x_start; /* Starting column for mvwaddnstr. Zero-based. */