From d83a8eb35998f895143531318dd07c062cc6558e Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Thu, 11 Apr 2019 15:25:44 +0200 Subject: [PATCH] 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. --- src/text.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/text.c b/src/text.c index ccc41d46..39d61466 100644 --- 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;