tweaks: condense and improve a handful of comments, and rewrap two lines

master
Benno Schulenberg 2018-11-22 20:00:18 +01:00
parent a7083d632b
commit 539a18e4c7
2 changed files with 18 additions and 30 deletions

View File

@ -170,8 +170,7 @@ void do_page_down(void)
}
#ifdef ENABLE_JUSTIFY
/* Move to the beginning of the first-found beginning-of-paragraph line
* before the current line. */
/* Move to the first beginning of a paragraph before the current line. */
void do_para_begin(filestruct **line)
{
if ((*line)->prev != NULL)
@ -181,25 +180,18 @@ void do_para_begin(filestruct **line)
*line = (*line)->prev;
}
/* Move down to the beginning of the last line of the current paragraph.
* Then move down one line farther if there is such a line, or to the
* end of the current line if not.
* A line is the last line of a paragraph if it is
* in a paragraph, and the next line either is the beginning line of a
* paragraph or isn't in a paragraph. Return whether the last line of
* the paragraph is part of the paragraph (instead of the line following
* the paragraph). */
/* Move down to the beginning of the last line of the current paragraph;
* then move down one line farther if there is such a line, or to the
* end of the last line if not. Return FALSE when we stepped to the
* line beyond the last line of the paragraph, and TRUE otherwise. */
bool do_para_end(filestruct **line)
{
while ((*line)->next != NULL &&
!inpar(*line))
while ((*line)->next != NULL && !inpar(*line))
*line = (*line)->next;
while ((*line)->next != NULL &&
inpar((*line)->next) &&
!begpar((*line)->next, 0)) {
while ((*line)->next != NULL && inpar((*line)->next) &&
!begpar((*line)->next, 0))
*line = (*line)->next;
}
if ((*line)->next != NULL) {
*line = (*line)->next;

View File

@ -2028,14 +2028,12 @@ bool inpar(const filestruct *const line)
return (line->data[quote_len + indent_len] != '\0');
}
/* Find the beginning of the current paragraph if we're in one, or the
* beginning of the next paragraph if we're not. Afterwards, save the
* first line of the paragraph in firstline, whether the last line of
* the paragraph is part of the paragraph (instead of the line following
* the paragraph) in bot_inpar, and
* quote length and paragraph length in *quote and *par. Return TRUE if
* we found a paragraph, and FALSE if there was an error or we didn't
* find a paragraph. */
/* Determine the beginning, length, and quoting of either the current
* paragraph (when we're in one) or the next paragraph (when we're not).
* Return TRUE if we found a paragraph, and FALSE otherwise. Furthermore,
* return in firstline the first line of the paragraph, in bot_inpar whether
* the last line of the buffer is part of the paragraph, and in *quote the
* length of the quoting and in *par the length of the paragraph. */
bool find_paragraph(filestruct **firstline, bool *bot_inpar,
size_t *const quote, size_t *const par)
{
@ -2051,9 +2049,8 @@ bool find_paragraph(filestruct **firstline, bool *bot_inpar,
return FALSE;
}
/* If we're at the end of the last line of the file, and we're not in a
* paragraph, it means that there aren't any paragraphs left, so get
* out. */
/* When at the end of the buffer and not in a paragraph, there aren't
* any paragraphs left, so get out. */
if (parline->next == NULL && !inpar(parline))
return FALSE;
@ -2097,9 +2094,8 @@ bool find_paragraph(filestruct **firstline, bool *bot_inpar,
quote_len = quote_length((*firstline)->data);
par_len = parline->lineno - (*firstline)->lineno;
/* If bot_inpar is TRUE, it means that we're at
* the end of the last line of the file, and the line isn't blank, in
* which case the last line of the file is part of the paragraph. */
/* When the last line of the buffer is part of the current paragraph,
* it means the paragraph is one line longer than computed. */
if (*bot_inpar == TRUE)
par_len++;