From b8196f0244d2a0b7adebe8d35182a071493eddf5 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 5 Jun 2016 05:08:23 -0400 Subject: have the display own the entire selection rather than just the selection location --- src/display.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/display.c') 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); -- cgit v1.2.3-54-g00ecf