commit d4468b2deff41d7d3bd220659df4279b4a6e15c1 parent 404a6862cdace77172f44009c6f154b5c3302500 Author: Benno Schulenberg <bensberg@telfort.nl> Date: Wed, 1 May 2019 19:10:56 +0200 tweaks: condense a comment and reshuffle a couple of lines Diffstat:
M | src/text.c | | | 12 | ++++++------ |
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/text.c b/src/text.c @@ -1355,18 +1355,18 @@ void update_undo(undo_type action) u->cutbuffer = copy_buffer(cutbuffer); } if (u->xflags & MARK_WAS_SET) { - /* If the "marking" operation was from right-->left or - * bottom-->top, then swap the mark points. */ - if ((u->lineno == u->mark_begin_lineno && u->begin < u->mark_begin_x) - || u->lineno < u->mark_begin_lineno) { + /* If the region was marked backwards, swap the end points. */ + if (u->lineno < u->mark_begin_lineno || + (u->lineno == u->mark_begin_lineno && + u->begin < u->mark_begin_x)) { ssize_t line = u->lineno; size_t x_loc = u->begin; + u->lineno = u->mark_begin_lineno; u->begin = u->mark_begin_x; - u->mark_begin_x = x_loc; - u->lineno = u->mark_begin_lineno; u->mark_begin_lineno = line; + u->mark_begin_x = x_loc; } else u->xflags |= WAS_MARKED_FORWARD; } else {