From a8ed1d7a9a79af51ce306b32656f2a956bcff367 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 29 Jan 2021 10:24:09 +0100 Subject: [PATCH] tweaks: don't bother wiping the multidata before recomputing it The precalc_multicolorinfo() routine will assign a value to every element for every line without looking at any current value, so wiping the data first is a waste of time. --- src/search.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/search.c b/src/search.c index d4f2c0e0..7f9751cb 100644 --- a/src/search.c +++ b/src/search.c @@ -521,19 +521,6 @@ char *replace_line(const char *needle) return copy; } -#ifdef ENABLE_COLOR -/* Reset the multiline coloring info and then recalculate it. */ -void wipe_and_recalculate_colorinfo(void) -{ - for (linestruct *line = openfile->filetop; line != NULL; line = line->next) - if (line->multidata) - for (short index = 0; index < openfile->syntax->nmultis; index++) - line->multidata[index] = -1; - - precalc_multicolorinfo(); -} -#endif - /* Step through each occurrence of the search string and prompt the user * before replacing it. We seek for needle, and replace it with answer. * The parameters real_current and real_current_x are needed in order to @@ -687,7 +674,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only, check_the_multis(openfile->current); if (refresh_needed && !replaceall) - wipe_and_recalculate_colorinfo(); + precalc_multicolorinfo(); #endif set_modified(); as_an_at = TRUE; @@ -700,7 +687,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only, #ifdef ENABLE_COLOR if (refresh_needed) - wipe_and_recalculate_colorinfo(); + precalc_multicolorinfo(); #endif #ifndef NANO_TINY