diff -u -r nano/nano.c nano-fix/nano.c --- nano/nano.c Mon Jul 29 23:51:25 2002 +++ nano-fix/nano.c Sun Aug 4 15:50:15 2002 @@ -2264,6 +2264,7 @@ quote_len = quote_length(IFREG(current->data, &qreg)); indent_len = indent_length(current->data + quote_len); + 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. */ @@ -2279,6 +2280,7 @@ /* indentation length of the previous line */ size_t temp_id_len = indent_length(current->prev->data + quote_len); + if (!indents_match(current->prev->data + quote_len, temp_id_len, current->data + quote_len, indent_len) || @@ -2286,6 +2288,7 @@ break; indent_len = temp_id_len; current = current->prev; + current_y--; } } } else { @@ -2293,9 +2296,16 @@ * to a non "blank" line. */ do { /* There is no next paragraph, so nothing to justify. */ - if (current->next == NULL) + if (current->next == NULL) { + placewewant = 0; + if (current_y > editwinrows - 4) + edit_update(current, CENTER); + else + edit_refresh(); return 0; + } current = current->next; + current_y++; quote_len = quote_length(IFREG(current->data, &qreg)); indent_len = indent_length(current->data + quote_len); } while (current->data[quote_len + indent_len] == '\0'); @@ -2478,11 +2488,11 @@ * fileage, set current_x. Also, edit_refresh() needs the line * numbers to be right, so we renumber(). */ last_par_line = current->prev; - if (first_mod_line != NULL && first_mod_line->prev == NULL) - fileage = first_mod_line; - current_x = 0; - if (first_mod_line != NULL) + if (first_mod_line != NULL) { + if (first_mod_line->prev == NULL) + fileage = first_mod_line; renumber(first_mod_line); + } if (current_y > editwinrows - 4) edit_update(current, CENTER);