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.
master
Benno Schulenberg 2021-01-29 10:24:09 +01:00
parent 94c371a38f
commit a8ed1d7a9a
1 changed files with 2 additions and 15 deletions

View File

@ -521,19 +521,6 @@ char *replace_line(const char *needle)
return copy; 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 /* Step through each occurrence of the search string and prompt the user
* before replacing it. We seek for needle, and replace it with answer. * 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 * 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); check_the_multis(openfile->current);
if (refresh_needed && !replaceall) if (refresh_needed && !replaceall)
wipe_and_recalculate_colorinfo(); precalc_multicolorinfo();
#endif #endif
set_modified(); set_modified();
as_an_at = TRUE; as_an_at = TRUE;
@ -700,7 +687,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR
if (refresh_needed) if (refresh_needed)
wipe_and_recalculate_colorinfo(); precalc_multicolorinfo();
#endif #endif
#ifndef NANO_TINY #ifndef NANO_TINY