From 0f8423eb4c5de4ecf58f5a32536e314882091c35 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sat, 22 Aug 2020 19:23:55 +0200 Subject: [PATCH] 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?) --- src/text.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/text.c b/src/text.c index c4668404..9b97a2d4 100644 --- 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;