mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-17 22:05:22 -05:00
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.
This commit is contained in:
parent
0e5a69d869
commit
edb78575c7
1 changed files with 12 additions and 1 deletions
13
selection.c
13
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue