From 6135e28878901fcf7287491e86e77c3e3973d3fa Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 29 Nov 2015 10:14:25 +0000 Subject: [PATCH] Resetting the multidata a bit less often. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5449 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 1 + src/color.c | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index c0b164b8..29abf9dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2015-11-29 Benno Schulenberg * src/color.c (reset_multis): Evaluate correctly whether to reset the multidata cache. This fixes Savannah bug #46543. + * src/color.c (reset_multis): Reset the multidata a bit less often. 2015-11-28 Benno Schulenberg * src/nano.c (main): Allow the user full control over the values of diff --git a/src/color.c b/src/color.c index 88ff3f1e..7f0de570 100644 --- a/src/color.c +++ b/src/color.c @@ -442,11 +442,8 @@ void reset_multis(filestruct *fileptr, bool force) continue; alloc_multidata_if_needed(fileptr); - if (force == TRUE) { - reset_multis_for_id(fileptr, tmpcolor->id); - continue; - } + if (force == FALSE) { /* Figure out where the first begin and end are to determine if * things changed drastically for the precalculated multi values. */ nobegin = regexec(tmpcolor->start, fileptr->data, 1, &startmatch, 0); @@ -458,10 +455,15 @@ void reset_multis(filestruct *fileptr, bool force) if (nobegin && noend) continue; } else if (fileptr->multidata[tmpcolor->id] == CBEGINBEFORE && !noend - && (nobegin || endmatch.rm_eo > startmatch.rm_eo)) { - reset_multis_after(fileptr, tmpcolor->id); + && nobegin) continue; - } + else if (fileptr->multidata[tmpcolor->id] == CSTARTENDHERE && + !nobegin && !noend && startmatch.rm_so < endmatch.rm_so) + continue; + else if (fileptr->multidata[tmpcolor->id] == CENDAFTER && + !nobegin && noend) + continue; + } /* If we got here, assume the worst. */ reset_multis_for_id(fileptr, tmpcolor->id); -- 2.39.5