From 8808dd28f21f7a8d75e9f0561ae5ed4a67d27895 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Wed, 12 Aug 2020 18:50:49 +0200 Subject: selection: adjust start point when the selection changes direction Without this, the initial cell will always be selected, regardless of how the selection is moved to the left or right. With this patch, the initial cell will only be selected while the selection is being made in the original direction. Changing direction of the selection moves the start point to next/previous character. --- terminal.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'terminal.h') diff --git a/terminal.h b/terminal.h index 1b41848d..14c12a62 100644 --- a/terminal.h +++ b/terminal.h @@ -181,6 +181,7 @@ enum mouse_reporting { enum cursor_style { CURSOR_BLOCK, CURSOR_UNDERLINE, CURSOR_BAR }; enum selection_kind { SELECTION_NONE, SELECTION_NORMAL, SELECTION_BLOCK }; +enum selection_direction {SELECTION_UNDIR, SELECTION_LEFT, SELECTION_RIGHT}; struct ptmx_buffer { void *data; @@ -306,6 +307,7 @@ struct terminal { struct { enum selection_kind kind; + enum selection_direction direction; struct coord start; struct coord end; } selection; -- cgit v1.3