[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nano-devel] [PATCH 1/2] justification: recognize indented paragraphs al
From: |
Benno Schulenberg |
Subject: |
[Nano-devel] [PATCH 1/2] justification: recognize indented paragraphs also without --autoindent |
Date: |
Mon, 21 May 2018 10:42:29 +0200 |
Pico does not require any option to do this, so nano should neither.
This fixes point 1) of https://savannah.gnu.org/bugs/?53933.
---
src/text.c | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
diff --git a/src/text.c b/src/text.c
index 80fd7aad..9977ce82 100644
--- a/src/text.c
+++ b/src/text.c
@@ -1911,13 +1911,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;
@@ -1939,9 +1933,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;
@@ -2309,12 +2302,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));
--
2.17.0
- [Nano-devel] [PATCH 1/2] justification: recognize indented paragraphs also without --autoindent,
Benno Schulenberg <=