nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit ef071255e5d096d080073d0fe2d319b7fa5826bf
parent afb6a5b86dc972ace56fbf553fbcdb992982614c
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Thu, 14 Jul 2016 17:49:41 +0200

color: refresh the screen whenever the active syntax changes

This fixes https://savannah.gnu.org/bugs/?47296.

Diffstat:
Msrc/files.c | 12+++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/files.c b/src/files.c @@ -2115,7 +2115,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type /* If we must set the filename, and it changed, adjust things. */ if (!nonamechange && strcmp(openfile->filename, realname) != 0) { #ifndef DISABLE_COLOR - char *syntaxname = openfile->syntax ? openfile->syntax->name : ""; + char *oldname = openfile->syntax ? openfile->syntax->name : ""; filestruct *line = openfile->fileage; #endif openfile->filename = mallocstrcpy(openfile->filename, realname); @@ -2125,19 +2125,17 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type color_update(); color_init(); + char *newname = openfile->syntax ? openfile->syntax->name : ""; + /* If the syntax changed, discard and recompute the multidata. */ - if (openfile->syntax && - strcmp(syntaxname, openfile->syntax->name) != 0) { + if (strcmp(oldname, newname) != 0) { for (; line != NULL; line = line->next) { free(line->multidata); line->multidata = NULL; } precalc_multicolorinfo(); + refresh_needed = TRUE; } - - /* If color syntaxes are available and turned on, refresh. */ - if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) - edit_refresh(); #endif }