From c2322f8563c28dcce0ed805c9d4b3f0c8178ba6a Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 27 Mar 2024 11:01:29 +0100 Subject: [PATCH] display: draw a new magic line rightaway when there are multiline regexes Drawing a line will allocate multidata for it (even when the line is actually empty), so that this multidata will not be missing later on when the next line gets drawn in the same burst of keystrokes. (This also removes the triggering of a full refresh when line numbers are active: only the new magic line needs to be additionally drawn, in order to get the line number printed.) This fixes https://savannah.gnu.org/bugs/?65516. The issue was reported by `correctmost`. Problem existed since version 6.3, commit 80c2000f. --- src/nano.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/nano.c b/src/nano.c index 47221064..130e6c3d 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1511,8 +1511,12 @@ void inject(char *burst, size_t count) /* If text was added to the magic line, create a new magic line. */ if (thisline == openfile->filebot && !ISSET(NO_NEWLINES)) { new_magicline(); - if (margin > 0) - refresh_needed = TRUE; +#ifdef ENABLE_COLOR + if (margin || (openfile->syntax && openfile->syntax->nmultis)) +#else + if (margin) +#endif + update_line(thisline->next, 0); } openfile->current_x += count;