nano

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

commit 9d7e62be1ada90d6f3732b5aba1e8dafeb3118ad
parent 5c008726f0db4c76e86dfe5c965e1e245f6efac9
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sun,  8 Mar 2020 14:08:49 +0100

tweaks: rename two variables, to be different or for more contrast

Also, invert the logic of the second.

Diffstat:
Msrc/text.c | 20++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/text.c b/src/text.c @@ -1300,14 +1300,14 @@ bool do_wrap(void) /* When requested, snip trailing blanks off the wrapped line. */ if (ISSET(TRIM_BLANKS)) { - size_t end_x = step_left(line->data, wrap_loc); + size_t rear_x = step_left(line->data, wrap_loc); size_t typed_x = step_left(line->data, cursor_x); - while ((end_x != typed_x || cursor_x >= wrap_loc) && - is_blank_mbchar(line->data + end_x)) { - openfile->current_x = end_x; + while ((rear_x != typed_x || cursor_x >= wrap_loc) && + is_blank_mbchar(line->data + rear_x)) { + openfile->current_x = rear_x; do_delete(); - end_x = step_left(line->data, end_x); + rear_x = step_left(line->data, rear_x); } } @@ -1734,8 +1734,8 @@ void do_justify(bool full_justify) #ifndef NANO_TINY bool right_side_up = FALSE; /* Whether the mark (if any) is before the cursor. */ - bool ends_at_eol = FALSE; - /* Whether the end of the marked region is at the end of a line. */ + bool before_eol = FALSE; + /* Whether the end of a marked region is before the end of its line. */ /* We need these to hold the leading part (quoting + indentation) of the * line where the marked text begins, whether or not that part is covered @@ -1766,8 +1766,8 @@ void do_justify(bool full_justify) par_len = endline->lineno - startline->lineno + (end_x > 0 ? 1 : 0); - /* Remember whether the end of the region was at the end of a line. */ - ends_at_eol = endline->data[end_x] == '\0'; + /* Remember whether the end of the region was before the end-of-line. */ + before_eol = endline->data[end_x] != '\0'; /* Copy the leading part that is to be used for the new paragraph. */ quote_len = quote_length(startline->data); @@ -1910,7 +1910,7 @@ void do_justify(bool full_justify) * of a line's leading part, make the new line start with the missing * portion, so it will become a full leading part when the justified * region is "pasted" back. */ - if (end_x > 0 && !ends_at_eol) { + if (end_x > 0 && before_eol) { line->next = make_new_node(line); line->next->data = copy_of(the_lead + needed_bot_extra); }