Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mouse mode bindings with multiple actions #7959

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Notable changes to the `alacritty_terminal` crate are documented in its
- New window being treated as focused when it's not on Wayland
- IME preview blending into text below it
- Dynamic title disabled for new windows when initial one has title as CLI option
- While terminal in mouse mode, mouse bindings that used the shift modifier and
had multiple actions only performed the first action

## 0.13.2

Expand Down
9 changes: 5 additions & 4 deletions alacritty/src/input/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down