commit 5737fe346122163306b817e2e4474c3cf7aba918
parent 72760159e78523d14f7eac4b81ce7bfc772cc3a1
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Sun, 20 Dec 2015 21:10:41 +0000
Precalculating the multiline-regex cache data for each buffer,
not just for the first. This fixes Savannah bug #46511.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5500 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
4 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,8 @@
+2015-12-20 Benno Schulenberg <bensberg@justemail.net>
+ * 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 <bensberg@justemail.net>
* 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
@@ -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
@@ -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
@@ -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,