nano

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

commit 0f8423eb4c5de4ecf58f5a32536e314882091c35
parent b60fec5db33c0532e0e7ac796a31275beb5e85b7
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sat, 22 Aug 2020 19:23:55 +0200

tweaks: elide an unneeded variable

Storing the orientation of the marked region beforehand is not needed,
as this orientation is readily available also after the justification.

(By the way, cursor and mark need to be swapped after justifying
a backward-marked region because the rule is that the cursor gets
placed *after* the justified paragraph.  Maybe that should change?)

Diffstat:
Msrc/text.c | 4+---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/text.c b/src/text.c @@ -1761,8 +1761,6 @@ void do_justify(bool full_justify) linestruct *jusline; /* The line that we're justifying in the current cutbuffer. */ #ifndef NANO_TINY - bool right_side_up = (openfile->mark && mark_is_before_cursor()); - /* Whether the mark (if any) is before the cursor. */ bool before_eol = FALSE; /* Whether the end of a marked region is before the end of its line. */ char *primary_lead = NULL; @@ -1980,7 +1978,7 @@ void do_justify(bool full_justify) update_undo(PASTE); /* After justifying a backward-marked text, swap mark and cursor. */ - if (openfile->mark && !right_side_up) { + if (openfile->mark && !mark_is_before_cursor()) { linestruct *bottom = openfile->current; size_t bottom_x = openfile->current_x;