diff --git a/ChangeLog b/ChangeLog index 144188e4..7fd52410 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-12-20 Benno Schulenberg + * src/files.c (display_buffer), src/nano.c (main): Precalculate the + multiline-regex cache data for each buffer, not just for the first. + This fixes Savannah bug #46511. + 2015-12-18 Benno Schulenberg * src/color.c (color_init): Use less #ifdefs, and adjust indentation. * src/color.c (set_colorpairs): Improve comments and rename vars. diff --git a/src/files.c b/src/files.c index 53e1b97e..db41c600 100644 --- a/src/files.c +++ b/src/files.c @@ -456,9 +456,14 @@ void display_buffer(void) titlebar(NULL); #ifndef DISABLE_COLOR - /* Make sure we're using the buffer's associated colors, if - * applicable. */ + /* Make sure we're using the buffer's associated colors. */ color_init(); + + /* If there are multiline coloring regexes, and there is no + * multiline cache data yet, precalculate it now. */ + if (openfile->syntax && openfile->syntax->nmultis > 0 && + openfile->fileage->multidata == NULL) + precalc_multicolorinfo(); #endif /* Update the edit window. */ diff --git a/src/nano.c b/src/nano.c index 18302e70..c92a89a6 100644 --- a/src/nano.c +++ b/src/nano.c @@ -2799,12 +2799,6 @@ int main(int argc, char **argv) fprintf(stderr, "Main: top and bottom win\n"); #endif -#ifndef DISABLE_COLOR - if (openfile->syntax) - if (openfile->syntax->nmultis > 0) - precalc_multicolorinfo(); -#endif - /* If a starting position was given on the command line, go there. */ if (startline > 0 || startcol > 0) do_gotolinecolumn(startline, startcol, FALSE, FALSE, FALSE, FALSE); diff --git a/src/proto.h b/src/proto.h index 2baa8688..c5118e66 100644 --- a/src/proto.h +++ b/src/proto.h @@ -506,6 +506,7 @@ int do_input(bool allow_funcs); int do_mouse(void); #endif void do_output(char *output, size_t output_len, bool allow_cntrls); +void precalc_multicolorinfo(void); /* All functions in prompt.c. */ int do_statusbar_input(bool *ran_func, bool *finished,