From b92fc023fb4eb093a0a9929d7918bfba5cc4c481 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 5 Jun 2016 07:28:45 -0400 Subject: allow storing reversed start/end for selections only ensure they're in the right order when pulling the selection text out of it, but leave it reversed otherwise (or else selecting behind the initial starting point will actually move the starting point of the selection, which is wrong) --- src/display.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/display.c b/src/display.c index 19df767..28b63e7 100644 --- a/src/display.c +++ b/src/display.c @@ -169,6 +169,14 @@ void runes_display_set_selection( display->has_selection = 1; + display->selection_start = *start; + display->selection_end = *end; + + if (t->display->selection_contents) { + free(t->display->selection_contents); + t->display->selection_contents = NULL; + } + if (end->row < start->row || (end->row == start->row && end->col < start->col)) { struct vt100_loc *tmp; @@ -177,13 +185,6 @@ void runes_display_set_selection( end = tmp; } - display->selection_start = *start; - display->selection_end = *end; - - if (t->display->selection_contents) { - free(t->display->selection_contents); - t->display->selection_contents = NULL; - } vt100_screen_get_string_plaintext( t->scr, start, end, &t->display->selection_contents, &t->display->selection_len); -- cgit v1.2.3-54-g00ecf