fix problem where mark_beginx wouldn't be saved properly in

backup_lines(), and add a few more cosmetic fixes


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2353 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2005-03-12 20:29:22 +00:00
parent cefd29e9fe
commit 59fe758a10
1 changed files with 12 additions and 7 deletions

View File

@ -2469,8 +2469,8 @@ bool quotes_match(const char *a_line, size_t a_quote, const char
/* Here is the assumption about a_quote. */ /* Here is the assumption about a_quote. */
assert(a_quote == quote_length(a_line)); assert(a_quote == quote_length(a_line));
return a_quote == quote_length(b_line) && return (a_quote == quote_length(b_line) &&
strncmp(a_line, b_line, a_quote) == 0; strncmp(a_line, b_line, a_quote) == 0);
} }
/* We assume a_line and b_line have no quote part. Then, we return /* We assume a_line and b_line have no quote part. Then, we return
@ -2481,8 +2481,8 @@ bool indents_match(const char *a_line, size_t a_indent, const char
assert(a_indent == indent_length(a_line)); assert(a_indent == indent_length(a_line));
assert(b_indent == indent_length(b_line)); assert(b_indent == indent_length(b_line));
return b_indent <= a_indent && return (b_indent <= a_indent &&
strncmp(a_line, b_line, b_indent) == 0; strncmp(a_line, b_line, b_indent) == 0);
} }
/* Is foo the beginning of a paragraph? /* Is foo the beginning of a paragraph?
@ -2617,9 +2617,12 @@ filestruct *backup_lines(filestruct *first_line, size_t par_len, size_t
#ifndef NANO_SMALL #ifndef NANO_SMALL
bool old_mark_set = ISSET(MARK_ISSET); bool old_mark_set = ISSET(MARK_ISSET);
int mbb_lineno_save = 0; int mbb_lineno_save = 0;
size_t mark_beginx_save = 0;
if (old_mark_set) if (old_mark_set) {
mbb_lineno_save = mark_beginbuf->lineno; mbb_lineno_save = mark_beginbuf->lineno;
mark_beginx_save = mark_beginx;
}
#endif #endif
/* Move bot down par_len lines to the newline after the last line of /* Move bot down par_len lines to the newline after the last line of
@ -2648,8 +2651,10 @@ filestruct *backup_lines(filestruct *first_line, size_t par_len, size_t
if (top->lineno == current_lineno_save) if (top->lineno == current_lineno_save)
current = top; current = top;
#ifndef NANO_SMALL #ifndef NANO_SMALL
if (old_mark_set && top->lineno == mbb_lineno_save) if (old_mark_set && top->lineno == mbb_lineno_save) {
mark_beginbuf = top; mark_beginbuf = top;
mark_beginx = mark_beginx_save;
}
#endif #endif
top = top->prev; top = top->prev;
} }
@ -3130,7 +3135,7 @@ void do_justify(bool full_justify)
* loop so that we justify all the paragraphs in the file. */ * loop so that we justify all the paragraphs in the file. */
if (!full_justify) if (!full_justify)
break; break;
} /* while (TRUE) */ }
/* We are now done justifying the paragraph or the file, so clean /* We are now done justifying the paragraph or the file, so clean
* up. totlines, totsize, and current_y have been maintained above. * up. totlines, totsize, and current_y have been maintained above.