tweaks: condense and improve a handful of comments, and rewrap two lines
Этот коммит содержится в:
родитель
a7083d632b
Коммит
539a18e4c7
24
src/move.c
24
src/move.c
@ -170,8 +170,7 @@ void do_page_down(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_JUSTIFY
|
#ifdef ENABLE_JUSTIFY
|
||||||
/* Move to the beginning of the first-found beginning-of-paragraph line
|
/* Move to the first beginning of a paragraph before the current line. */
|
||||||
* before the current line. */
|
|
||||||
void do_para_begin(filestruct **line)
|
void do_para_begin(filestruct **line)
|
||||||
{
|
{
|
||||||
if ((*line)->prev != NULL)
|
if ((*line)->prev != NULL)
|
||||||
@ -181,25 +180,18 @@ void do_para_begin(filestruct **line)
|
|||||||
*line = (*line)->prev;
|
*line = (*line)->prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move down to the beginning of the last line of the current 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
|
* then move down one line farther if there is such a line, or to the
|
||||||
* end of the current line if not.
|
* end of the last line if not. Return FALSE when we stepped to the
|
||||||
* A line is the last line of a paragraph if it is
|
* line beyond the last line of the paragraph, and TRUE otherwise. */
|
||||||
* 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). */
|
|
||||||
bool do_para_end(filestruct **line)
|
bool do_para_end(filestruct **line)
|
||||||
{
|
{
|
||||||
while ((*line)->next != NULL &&
|
while ((*line)->next != NULL && !inpar(*line))
|
||||||
!inpar(*line))
|
|
||||||
*line = (*line)->next;
|
*line = (*line)->next;
|
||||||
|
|
||||||
while ((*line)->next != NULL &&
|
while ((*line)->next != NULL && inpar((*line)->next) &&
|
||||||
inpar((*line)->next) &&
|
!begpar((*line)->next, 0))
|
||||||
!begpar((*line)->next, 0)) {
|
|
||||||
*line = (*line)->next;
|
*line = (*line)->next;
|
||||||
}
|
|
||||||
|
|
||||||
if ((*line)->next != NULL) {
|
if ((*line)->next != NULL) {
|
||||||
*line = (*line)->next;
|
*line = (*line)->next;
|
||||||
|
24
src/text.c
24
src/text.c
@ -2028,14 +2028,12 @@ bool inpar(const filestruct *const line)
|
|||||||
return (line->data[quote_len + indent_len] != '\0');
|
return (line->data[quote_len + indent_len] != '\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find the beginning of the current paragraph if we're in one, or the
|
/* Determine the beginning, length, and quoting of either the current
|
||||||
* beginning of the next paragraph if we're not. Afterwards, save the
|
* paragraph (when we're in one) or the next paragraph (when we're not).
|
||||||
* first line of the paragraph in firstline, whether the last line of
|
* Return TRUE if we found a paragraph, and FALSE otherwise. Furthermore,
|
||||||
* the paragraph is part of the paragraph (instead of the line following
|
* return in firstline the first line of the paragraph, in bot_inpar whether
|
||||||
* the paragraph) in bot_inpar, and
|
* the last line of the buffer is part of the paragraph, and in *quote the
|
||||||
* quote length and paragraph length in *quote and *par. Return TRUE if
|
* length of the quoting and in *par the length of the paragraph. */
|
||||||
* we found a paragraph, and FALSE if there was an error or we didn't
|
|
||||||
* find a paragraph. */
|
|
||||||
bool find_paragraph(filestruct **firstline, bool *bot_inpar,
|
bool find_paragraph(filestruct **firstline, bool *bot_inpar,
|
||||||
size_t *const quote, size_t *const par)
|
size_t *const quote, size_t *const par)
|
||||||
{
|
{
|
||||||
@ -2051,9 +2049,8 @@ bool find_paragraph(filestruct **firstline, bool *bot_inpar,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we're at the end of the last line of the file, and we're not in a
|
/* When at the end of the buffer and not in a paragraph, there aren't
|
||||||
* paragraph, it means that there aren't any paragraphs left, so get
|
* any paragraphs left, so get out. */
|
||||||
* out. */
|
|
||||||
if (parline->next == NULL && !inpar(parline))
|
if (parline->next == NULL && !inpar(parline))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -2097,9 +2094,8 @@ bool find_paragraph(filestruct **firstline, bool *bot_inpar,
|
|||||||
quote_len = quote_length((*firstline)->data);
|
quote_len = quote_length((*firstline)->data);
|
||||||
par_len = parline->lineno - (*firstline)->lineno;
|
par_len = parline->lineno - (*firstline)->lineno;
|
||||||
|
|
||||||
/* If bot_inpar is TRUE, it means that we're at
|
/* When the last line of the buffer is part of the current paragraph,
|
||||||
* the end of the last line of the file, and the line isn't blank, in
|
* it means the paragraph is one line longer than computed. */
|
||||||
* which case the last line of the file is part of the paragraph. */
|
|
||||||
if (*bot_inpar == TRUE)
|
if (*bot_inpar == TRUE)
|
||||||
par_len++;
|
par_len++;
|
||||||
|
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user