diff options
author | Jesse Luehrs <doy@tozt.net> | 2016-06-05 05:08:23 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2016-06-05 05:08:23 -0400 |
commit | b8196f0244d2a0b7adebe8d35182a071493eddf5 (patch) | |
tree | a381825d4e9e4ccd3bdb3bafcf334973c1fb01ff /src/display.c | |
parent | 7f59d00de5bb1b329ce6d332056f8c55348740b0 (diff) | |
download | runes-b8196f0244d2a0b7adebe8d35182a071493eddf5.tar.gz runes-b8196f0244d2a0b7adebe8d35182a071493eddf5.zip |
have the display own the entire selection
rather than just the selection location
Diffstat (limited to 'src/display.c')
-rw-r--r-- | src/display.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/display.c b/src/display.c index 92dfab3..19df767 100644 --- a/src/display.c +++ b/src/display.c @@ -162,6 +162,35 @@ void runes_display_draw_cursor(RunesTerm *t) } } +void runes_display_set_selection( + RunesTerm *t, struct vt100_loc *start, struct vt100_loc *end) +{ + RunesDisplay *display = t->display; + + display->has_selection = 1; + + if (end->row < start->row || (end->row == start->row && end->col < start->col)) { + struct vt100_loc *tmp; + + tmp = start; + start = end; + 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); + + t->display->dirty = 1; +} + void runes_display_delete(RunesDisplay *display) { cairo_pattern_destroy(display->buffer); |