nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 59fe758a10b282accb2b534df8190d0a7c5efffd
parent cefd29e9fe0c07d933640dc515383be4e42c1f77
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date:   Sat, 12 Mar 2005 20:29:22 +0000

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

Diffstat:
Msrc/nano.c | 19++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/nano.c b/src/nano.c @@ -2469,8 +2469,8 @@ bool quotes_match(const char *a_line, size_t a_quote, const char /* Here is the assumption about a_quote. */ assert(a_quote == quote_length(a_line)); - return a_quote == quote_length(b_line) && - strncmp(a_line, b_line, a_quote) == 0; + return (a_quote == quote_length(b_line) && + strncmp(a_line, b_line, a_quote) == 0); } /* 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(b_indent == indent_length(b_line)); - return b_indent <= a_indent && - strncmp(a_line, b_line, b_indent) == 0; + return (b_indent <= a_indent && + strncmp(a_line, b_line, b_indent) == 0); } /* 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 bool old_mark_set = ISSET(MARK_ISSET); 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; + mark_beginx_save = mark_beginx; + } #endif /* 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) current = top; #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_beginx = mark_beginx_save; + } #endif top = top->prev; } @@ -3130,7 +3135,7 @@ void do_justify(bool full_justify) * loop so that we justify all the paragraphs in the file. */ if (!full_justify) break; - } /* while (TRUE) */ + } /* We are now done justifying the paragraph or the file, so clean * up. totlines, totsize, and current_y have been maintained above.