nano

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

commit f2d89cb3bcb15a95d550c3f1c5e7e2b84f649f3f
parent 2d05ce37c60a157760f386badc387e2d53b2fa75
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Thu,  5 Mar 2020 18:42:14 +0100

justify: restore a region properly when it was marked backwards

This fixes https://savannah.gnu.org/bugs/?57960.

Bug existed since version 4.8, commit e01651cd.

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

diff --git a/src/text.c b/src/text.c @@ -2131,10 +2131,9 @@ void do_justify(bool full_justify) /* If we justified marked text, restore mark or cursor position. */ if (openfile->mark) { - if (right_side_up) { - openfile->mark = line_from_number(was_top_lineno); - openfile->mark_x = was_top_x; - } else { + if (!right_side_up) { + openfile->mark = openfile->current; + openfile->mark_x = openfile->current_x; openfile->current = line_from_number(was_top_lineno); openfile->current_x = was_top_x; }