diff options
author | Jesse Luehrs <doy@tozt.net> | 2016-06-05 07:28:45 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2016-06-05 07:28:45 -0400 |
commit | b92fc023fb4eb093a0a9929d7918bfba5cc4c481 (patch) | |
tree | b90db219118ed4fdd3be3cddae43233aa5e8ff25 /src | |
parent | eb7e60537c7047a96f036efa09c735eb8f572600 (diff) | |
download | runes-b92fc023fb4eb093a0a9929d7918bfba5cc4c481.tar.gz runes-b92fc023fb4eb093a0a9929d7918bfba5cc4c481.zip |
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)
Diffstat (limited to 'src')
-rw-r--r-- | src/display.c | 15 |
1 files 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); |