diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-08-14 05:39:11 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-08-14 05:39:11 +0000 |
| commit | 394db77b04294c505e0a66560e5d8b13150f1191 (patch) | |
| tree | a01d72bd6abed970261fb5c4fa4fb331c7ff5d64 /selection.c | |
| parent | Merge branch 'click-count-in-mouse-bindings' into master (diff) | |
| parent | input: mouse motion: don't update selection while scrollback searching (diff) | |
Merge branch 'mouse-binding-actions' into master
Closes #79. Closes #75.
Diffstat (limited to 'selection.c')
| -rw-r--r-- | selection.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/selection.c b/selection.c index a078a698..0f1731e6 100644 --- a/selection.c +++ b/selection.c @@ -237,6 +237,7 @@ selection_start(struct terminal *term, int col, int row, term->selection.kind = kind; term->selection.start = (struct coord){col, term->grid->view + row}; term->selection.end = (struct coord){-1, -1}; + term->selection.ongoing = true; } static bool @@ -310,6 +311,9 @@ selection_update(struct terminal *term, int col, int row) if (term->selection.start.row < 0) return; + if (!term->selection.ongoing) + 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, @@ -532,6 +536,8 @@ selection_extend(struct seat *seat, struct terminal *term, return; } + term->selection.ongoing = true; + row += term->grid->view; if ((row == term->selection.start.row && col == term->selection.start.col) || @@ -563,6 +569,11 @@ selection_extend(struct seat *seat, struct terminal *term, void selection_finalize(struct seat *seat, struct terminal *term, uint32_t serial) { + if (!term->selection.ongoing) + return; + + term->selection.ongoing = false; + if (term->selection.start.row < 0 || term->selection.end.row < 0) return; @@ -600,6 +611,7 @@ selection_cancel(struct terminal *term) term->selection.start = (struct coord){-1, -1}; term->selection.end = (struct coord){-1, -1}; term->selection.direction = SELECTION_UNDIR; + term->selection.ongoing = false; } void |
