diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2019-11-30 10:59:47 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2019-11-30 10:59:47 +0000 |
| commit | edb78575c7a7193e60d0f226143f75a29360290b (patch) | |
| tree | 8ef855d644aad6f8344dcf8ee584d171de1d0cdd | |
| parent | vt: don't try to move cursor outside the terminal (diff) | |
selection: forced selection requires keyboard focus
Up the requirements for enabling "forced" selection (that is, allowing
selections even though mouse tracking has been disabled).
* Require keyboard focus (if we don't have it, then the shift-key
isn't is for us)
* Don't just require shift being pressed, but that all other modifiers
are *not* pressed.
| -rw-r--r-- | selection.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/selection.c b/selection.c index 2839636a..8aa97e13 100644 --- a/selection.c +++ b/selection.c @@ -21,12 +21,23 @@ #define min(x, y) ((x) < (y) ? (x) : (y)) #define max(x, y) ((x) > (y) ? (x) : (y)) +static bool +selection_forced(const struct terminal *term) +{ + const struct wayland *wayl = term->wl; + return wayl->focused == term && + wayl->kbd.shift && + !wayl->kbd.alt && + !wayl->kbd.ctrl && + !wayl->kbd.meta; +} + bool selection_enabled(const struct terminal *term) { return term->mouse_tracking == MOUSE_NONE || - term->wl->kbd.shift || + selection_forced(term) || term->is_searching; } |
