- For consistency, preserve placewewant if we didn't unjustify
instead of setting it to 0. (DLR)
- When justifying the entire file, properly break out of the
- loop if there are no more paragraphs after the current one and
- the paragraph search left us on the magicline, so as to avoid
- a segfault. (DLR)
+ loop if we've found at least one paragraph, there are no more
+ paragraphs after the current one, and the paragraph search
+ left us on the magicline. This avoids a segfault. (DLR)
do_input()
- Add finished parameter, used to indicate when we run or try to
run a function associated with a shortcut. (DLR)
* is the start of this paragraph if we're in one, or the start
* of the next otherwise. Save the quote length and paragraph
* length (number of lines). Don't refresh the screen yet,
- * since we'll do that after we justify. If the search
- * failed, we're justifying the whole file, and the search
- * didn't leave us on the last line of the file, set the last
- * line of the text to be justified to the last line of the file
- * and break out of the loop. Otherwise, refresh the screen and
- * get out. */
+ * since we'll do that after we justify.
+ *
+ * If the search failed, we do one of two things. If we're
+ * justifying the whole file, we've found at least one
+ * paragraph, and the search didn't leave us on the last line of
+ * the file, it means that we should justify all the way to the
+ * last line of the file, so set the last line of the text to be
+ * justified to the last line of the file and break out of the
+ * loop. Otherwise, it means that there are no paragraph(s) to
+ * justify, so refresh the screen and get out. */
if (!find_paragraph("e_len, &par_len)) {
- if (full_justify && first_par_line != filebot) {
+ if (full_justify && first_par_line != NULL &&
+ first_par_line != filebot) {
last_par_line = filebot;
break;
} else {