justify: recompute the multidata for paragraphs larger than the viewport

A freshly justified paragraph does not yet have any multidata,
and if this new paragraph has more lines than fit in the viewport
(minus one line for the cursor), then the line above the top of the
new viewport will be without multidata.  The coloring code cannot
handle this, so all the multidata then needs to be recalculated.

This fixes https://savannah.gnu.org/bugs/?65396.
The issue was reported by `correctmost`.

Problem existed since version 6.3, commit 80c2000f.
This commit is contained in:
Benno Schulenberg 2024-03-03 12:01:14 +01:00
parent f37d097c1c
commit 4ab80abb5e

View File

@ -1687,6 +1687,12 @@ void rewrap_paragraph(linestruct **line, char *lead_string, size_t lead_len)
*line = (*line)->next;
}
#ifdef ENABLE_COLOR
/* If the new paragraph exceeds the viewport, recalculate the multidata. */
if ((*line)->lineno >= editwinrows)
recook = TRUE;
#endif
/* When possible, go to the line after the rewrapped paragraph. */
if ((*line)->next != NULL)
*line = (*line)->next;
@ -2015,6 +2021,9 @@ void do_full_justify(void)
{
justify_text(WHOLE_BUFFER);
ran_a_tool = TRUE;
#ifdef ENABLE_COLOR
recook = TRUE;
#endif
}
#endif /* ENABLE_JUSTIFY */