Using the main multidata-cache-allocation routine.

(Note that there can only be colorstrings when there /is/ a syntax,
so there is no need to check for the latter here.)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5452 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2015-11-29 13:20:08 +00:00
parent e19a16f0e6
commit ee33503402
2 changed files with 5 additions and 10 deletions

View File

@ -6,6 +6,7 @@
* src/winio.c (edit_draw): When an end is found but nothing is painted * src/winio.c (edit_draw): When an end is found but nothing is painted
(because the coloured part is horizontally scrolled off), nevertheless (because the coloured part is horizontally scrolled off), nevertheless
set the multidata to CBEGINBEFORE. This fixes Savannah bug #46545. 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> 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

View File

@ -2481,16 +2481,10 @@ void edit_draw(filestruct *fileptr, const char *converted, int
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) { if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) {
const colortype *tmpcolor = openfile->colorstrings; const colortype *tmpcolor = openfile->colorstrings;
/* Set up multi-line color data for this line if it's not yet /* If there are multiline regexes, make sure there is a cache. */
* calculated. */ if (openfile->syntax->nmultis > 0)
if (fileptr->multidata == NULL && openfile->syntax alloc_multidata_if_needed(fileptr);
&& 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;
}
for (; tmpcolor != NULL; tmpcolor = tmpcolor->next) { for (; tmpcolor != NULL; tmpcolor = tmpcolor->next) {
int x_start; int x_start;
/* Starting column for mvwaddnstr. Zero-based. */ /* Starting column for mvwaddnstr. Zero-based. */