aboutsummaryrefslogtreecommitdiff
path: root/selection.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-07-26 10:31:13 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-07-26 10:37:02 +0000
commitc1f35731e0a98344b605d5b07caa77c2f00e3791 (patch)
tree32bef6ebc5aa47aa0c2d1560d8a717d785fe6e51 /selection.c
parentconfig: scrollback-indicator-format: percent -> percentage (diff)
input: margins are not selectable
* Fix col/row calculation in pointer-enter event; we did not take the margins into account. * seat->mouse.col,row are now set to -1 if the cursor is inside the margins. That is, col/row are only ever valid when the mouse is actually over the grid, and not in the margins. * Use regular 'left-ptr' mouse cursor when mouse is inside the margins, to not make the user think he/she can start a selection. Besides making things clearer, this also fixes a crash that occurred if you started a selection in e.g. the right margin.
Diffstat (limited to 'selection.c')
-rw-r--r--selection.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/selection.c b/selection.c
index d5add464..3b8c1969 100644
--- a/selection.c
+++ b/selection.c
@@ -25,9 +25,10 @@ bool
selection_enabled(const struct terminal *term, struct seat *seat)
{
return
- term->mouse_tracking == MOUSE_NONE ||
- term_mouse_grabbed(term, seat) ||
- term->is_searching;
+ seat->mouse.col >= 0 && seat->mouse.row >= 0 &&
+ (term->mouse_tracking == MOUSE_NONE ||
+ term_mouse_grabbed(term, seat) ||
+ term->is_searching);
}
bool