mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
selection: disable selection when client has enabled mouse tracking
This commit is contained in:
parent
bcf763d417
commit
d944274f14
1 changed files with 18 additions and 0 deletions
18
selection.c
18
selection.c
|
|
@ -8,9 +8,18 @@
|
|||
#define min(x, y) ((x) < (y) ? (x) : (y))
|
||||
#define max(x, y) ((x) > (y) ? (x) : (y))
|
||||
|
||||
static bool
|
||||
selection_enabled(const struct terminal *term)
|
||||
{
|
||||
return term->mouse_tracking == MOUSE_NONE;
|
||||
}
|
||||
|
||||
void
|
||||
selection_start(struct terminal *term, int col, int row)
|
||||
{
|
||||
if (!selection_enabled(term))
|
||||
return;
|
||||
|
||||
selection_cancel(term);
|
||||
|
||||
LOG_DBG("selection started at %d,%d", row, col);
|
||||
|
|
@ -21,6 +30,9 @@ selection_start(struct terminal *term, int col, int row)
|
|||
void
|
||||
selection_update(struct terminal *term, int col, int row)
|
||||
{
|
||||
if (!selection_enabled(term))
|
||||
return;
|
||||
|
||||
LOG_DBG("selection updated: start = %d,%d, end = %d,%d -> %d, %d",
|
||||
term->selection.start.row, term->selection.start.col,
|
||||
term->selection.end.row, term->selection.end.col,
|
||||
|
|
@ -41,6 +53,9 @@ selection_update(struct terminal *term, int col, int row)
|
|||
void
|
||||
selection_finalizie(struct terminal *term)
|
||||
{
|
||||
if (!selection_enabled(term))
|
||||
return;
|
||||
|
||||
assert(term->selection.start.row != -1);
|
||||
assert(term->selection.end.row != -1);
|
||||
}
|
||||
|
|
@ -48,6 +63,9 @@ selection_finalizie(struct terminal *term)
|
|||
void
|
||||
selection_cancel(struct terminal *term)
|
||||
{
|
||||
if (!selection_enabled(term))
|
||||
return;
|
||||
|
||||
LOG_DBG("selection cancelled: start = %d,%d end = %d,%d",
|
||||
term->selection.start.row, term->selection.start.col,
|
||||
term->selection.end.row, term->selection.end.col);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue