aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/input
diff options
context:
space:
mode:
authorEBADBEEF <errno@ebadf.com>2024-05-16 14:15:20 -0700
committerJosh Rahm <rahm@google.com>2024-08-14 15:42:41 -0600
commit7574c3fee7bd4f368c4789a85642bbecf0cd5ae9 (patch)
treea590572eff17af565bf4b6c8d9875a92555e10a7 /alacritty/src/input
parent0704735fa0f5d3a92e54ca62920c5010468dfa78 (diff)
downloadr-alacritty-7574c3fee7bd4f368c4789a85642bbecf0cd5ae9.tar.gz
r-alacritty-7574c3fee7bd4f368c4789a85642bbecf0cd5ae9.tar.bz2
r-alacritty-7574c3fee7bd4f368c4789a85642bbecf0cd5ae9.zip
Fix mouse mode bindings with multiple actions
The following config was broken: ``` [mouse] bindings = [ { mouse = "Right", mods = "Shift", action = "Copy" }, { mouse = "Right", mods = "Shift", action = "ClearSelection" }, ] ``` Only the first action was applied. Change to allow more than one exact match in mouse mode with shift held, but keep the logic to not allow fallback search if any exact match was found. Regression was introduced in 1a143d11.
Diffstat (limited to 'alacritty/src/input')
-rw-r--r--alacritty/src/input/mod.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/alacritty/src/input/mod.rs b/alacritty/src/input/mod.rs
index 095e8737..4900e26f 100644
--- a/alacritty/src/input/mod.rs
+++ b/alacritty/src/input/mod.rs
@@ -1004,17 +1004,18 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> {
let mouse_bindings = self.ctx.config().mouse_bindings().to_owned();
// If mouse mode is active, also look for bindings without shift.
- let mut check_fallback = mouse_mode && mods.contains(ModifiersState::SHIFT);
+ let fallback_allowed = mouse_mode && mods.contains(ModifiersState::SHIFT);
+ let mut exact_match_found = false;
for binding in &mouse_bindings {
// Don't trigger normal bindings in mouse mode unless Shift is pressed.
- if binding.is_triggered_by(mode, mods, &button) && (check_fallback || !mouse_mode) {
+ if binding.is_triggered_by(mode, mods, &button) && (fallback_allowed || !mouse_mode) {
binding.action.execute(&mut self.ctx);
- check_fallback = false;
+ exact_match_found = true;
}
}
- if check_fallback {
+ if fallback_allowed && !exact_match_found {
let fallback_mods = mods & !ModifiersState::SHIFT;
for binding in &mouse_bindings {
if binding.is_triggered_by(mode, fallback_mods, &button) {