diff --git a/src/text.c b/src/text.c index 62ede61c..9f7548ec 100644 --- a/src/text.c +++ b/src/text.c @@ -2129,14 +2129,12 @@ void do_justify(bool full_justify) add_undo(COUPLE_END, "justification"); - /* If we justified marked text, restore mark or cursor position. */ - if (openfile->mark) { - 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; - } + /* After justifying a backward-marked text, swap mark and cursor. */ + if (openfile->mark && !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; update_undo(COUPLE_END); } #endif