diff --git a/ChangeLog b/ChangeLog index bd995521b26d5dbeaca773ee289ffc22206341bc..7ac85f53ce3b6274689147003faab0ea02c660d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ * src/nano.c (do_output): Let reset_multis() figure out whether after an addition a full refresh is needed (for multiline-regexes' sake), instead of doing it always. + * src/color.c (reset_multis): Abort when having no multiline regexes. 2016-01-02 Benno Schulenberg <bensberg@justemail.net> * src/text.c (do_spell, do_formatter): Plug three tiny memory leaks. diff --git a/src/color.c b/src/color.c index 2508a843013e599cf189eff87ba229e91a6ed4cc..dd93bd7e6b1054611662a668ba317e211c87d478 100644 --- a/src/color.c +++ b/src/color.c @@ -417,7 +417,8 @@ void reset_multis(filestruct *fileptr, bool force) regmatch_t startmatch, endmatch; const colortype *tmpcolor = openfile->colorstrings; - if (!openfile->syntax) + /* If there is no syntax or no multiline regex, there is nothing to do. */ + if (openfile->syntax == NULL || openfile->syntax->nmultis == 0) return; for (; tmpcolor != NULL; tmpcolor = tmpcolor->next) { diff --git a/src/nano.c b/src/nano.c index 43903453ec85c8bc0ee7f005ec07ecc84a62b239..20ac4adeacd2e55bf3e9587c944332e55913e2d0 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1728,8 +1728,7 @@ int do_input(bool allow_funcs) /* Execute the function of the shortcut. */ s->scfunc(); #ifndef DISABLE_COLOR - if (f && !f->viewok && openfile->syntax != NULL - && openfile->syntax->nmultis > 0) + if (f && !f->viewok) reset_multis(openfile->current, FALSE); #endif if (edit_refresh_needed) {