justify: verify being in a paragraph before trying to find its beginning

If find_paragraph() detects that we're not in a paragraph, it moves
forward a paragraph and then backward to that paragraph's beginning.
Make it check whether we're in a paragraph before moving backward
(since there might not *be* any more paragraphs), to prevent going
forth-and-back and never reaching the end of the buffer.

This fixes https://savannah.gnu.org/bugs/?54573.
master
David Lawrence Ramsey 2018-08-26 12:54:56 -05:00 committed by Benno Schulenberg
parent 80bea3eb9b
commit 93c8e316a8
1 changed files with 2 additions and 2 deletions

View File

@ -2148,9 +2148,9 @@ bool find_paragraph(size_t *const quote, size_t *const par)
}
}
/* If the current line isn't the first line of the paragraph, move
/* If the current line is in a paragraph and isn't its first line, move
* back to the first line of the paragraph. */
if (!begpar(openfile->current, 0))
if (inpar(openfile->current) && !begpar(openfile->current, 0))
do_para_begin(FALSE);
/* Now current is the first line of the paragraph. Set quote_len to