commit d7fe5a7db38b5c0d285b04d3e6058a85aa73458e
parent a6c0212158681611b9a065edd8974ead85d132c2
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Fri, 18 May 2018 12:51:14 +0200
justification: recognize indented paragraphs also without --autoindent
Pico does not require any option to do this, so nano should neither.
This fixes point 1) of https://savannah.gnu.org/bugs/?53933.
Diffstat:
1 file changed, 2 insertions(+), 15 deletions(-)
diff --git a/src/text.c b/src/text.c
@@ -2004,13 +2004,7 @@ bool indents_match(const char *a_line, size_t a_indent, const char
* 2) the line above it is not part of a paragraph, or
* 3) the line above it has a different quote part, or
* 4) the indentation of this line is not an initial substring of
- * the indentation of the previous line, or
- * 5) this line has no quote part and some indentation, and
- * autoindent isn't turned on.
- * The reason for number 5) is that if autoindent isn't turned on,
- * then an indented line is expected to start a paragraph, as in
- * books. Thus, nano can justify an indented paragraph only if
- * autoindent is turned on. */
+ * the indentation of the previous line. */
bool begpar(const filestruct *const line)
{
size_t quote_len, indent_len, temp_id_len;
@@ -2032,9 +2026,8 @@ bool begpar(const filestruct *const line)
temp_id_len = indent_length(line->prev->data + quote_len);
- /* Case 2) or 5) or 4). */
+ /* Case 2) or 4). */
if (line->prev->data[quote_len + temp_id_len] == '\0' ||
- (quote_len == 0 && indent_len > 0 && !ISSET(AUTOINDENT)) ||
!indents_match(line->prev->data + quote_len, temp_id_len,
line->data + quote_len, indent_len))
return TRUE;
@@ -2402,12 +2395,6 @@ void do_justify(bool full_justify)
* just after the space. */
break_pos += indent_len + 1;
- /* If this paragraph is non-quoted, and autoindent isn't
- * turned on, set the indentation length to zero so that the
- * indentation is treated as part of the line. */
- if (quote_len == 0 && !ISSET(AUTOINDENT))
- indent_len = 0;
-
/* Insert a new line after the current one. */
splice_node(openfile->current, make_new_node(openfile->current));