diff -u -r nano-34/nano.c nano-35/nano.c --- nano-34/nano.c Sat Sep 7 21:12:00 2002 +++ nano-35/nano.c Sat Sep 7 21:10:12 2002 @@ -2177,7 +2177,7 @@ * 2) the line above it is not part of a paragraph, or * 3) the line above it does not have precisely the same quote * part, or - * 4) the indentation of this line is not a subset of the + * 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 is not set. @@ -2250,29 +2250,28 @@ current_x = 0; if (current->data[quote_len + indent_len] != '\0') { /* This line is part of a paragraph. So we must search back to - * the first line of this paragraph. */ - if (quote_len > 0 || indent_len == 0 -#ifndef NANO_SMALL - || ISSET(AUTOINDENT) -#endif - ) { - /* We don't justify indented paragraphs unless AUTOINDENT is - * turned on. See 5) above. */ - while (current->prev && quotes_match(current->data, + * the first line of this paragraph. First we check items 1) and + * 3) above. */ + while (current->prev && quotes_match(current->data, quote_len, IFREG(current->prev->data, &qreg))) { - /* indentation length of the previous line */ - size_t temp_id_len = + size_t temp_id_len = indent_length(current->prev->data + quote_len); + /* The indentation length of the previous line. */ - if (!indents_match(current->prev->data + quote_len, - temp_id_len, current->data + quote_len, - indent_len) || - current->prev->data[quote_len + temp_id_len] == '\0') - break; - indent_len = temp_id_len; - current = current->prev; - current_y--; - } + /* Is this line the beginning of a paragraph, according to + items 2), 5), or 4) above? If so, stop. */ + if (current->prev->data[quote_len + temp_id_len] == '\0' || + (quote_len == 0 && indent_len > 0 +#ifndef NANO_SMALL + && !ISSET(AUTOINDENT) +#endif + ) || + !indents_match(current->prev->data + quote_len, + temp_id_len, current->data + quote_len, indent_len)) + break; + indent_len = temp_id_len; + current = current->prev; + current_y--; } } else { /* This line is not part of a paragraph. Move down until we get