nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 4ab80abb5e769ca4c20e6321d3f10c9142c98974
parent f37d097c1c8468572d2d39a0cdea5f5a9ecc757e
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sun,  3 Mar 2024 12:01:14 +0100

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.

Diffstat:
Msrc/text.c | 9+++++++++
1 file changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/text.c b/src/text.c @@ -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 */