nano

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

commit d83a8eb35998f895143531318dd07c062cc6558e
parent 98cc39e8e5d4e835e71c7fe608c5dc9327bb90ac
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Thu, 11 Apr 2019 15:25:44 +0200

justify: correctly compute the number of lines to take, to avoid a crash

When the file starts with one or more blank lines, the first paragraph
doesn't start on line 1.

This fixes https://savannah.gnu.org/bugs/?56117.

Bug existed since version 4.0, commit ac8bd2a2.

Diffstat:
Msrc/text.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/text.c b/src/text.c @@ -2070,7 +2070,7 @@ void do_justify(bool full_justify) /* Set the number of lines to be pulled into the cutbuffer. */ if (full_justify) - jus_len = openfile->filebot->lineno; + jus_len = openfile->filebot->lineno - first_par_line->lineno + 1; else jus_len = par_len;