From 01554367f00f7c39ad17163cd5922a069284844a Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Mon, 11 Oct 2021 01:15:39 -0600 Subject: Make keybindings more consistent with libtermkey --- alacritty/src/config/bindings.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'alacritty/src/config/bindings.rs') diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs index 9f4bbaee..dc648541 100644 --- a/alacritty/src/config/bindings.rs +++ b/alacritty/src/config/bindings.rs @@ -1,5 +1,6 @@ #![allow(clippy::enum_glob_use)] +use log::{trace}; use std::fmt::{self, Debug, Display}; use bitflags::bitflags; @@ -47,16 +48,21 @@ pub type KeyBinding = Binding; /// Bindings that are triggered by a mouse button. pub type MouseBinding = Binding; -impl Binding { +impl Binding { #[inline] pub fn is_triggered_by(&self, mode: BindingMode, mods: ModifiersState, input: &T) -> bool { // Check input first since bindings are stored in one big list. This is // the most likely item to fail so prioritizing it here allows more // checks to be short circuited. - self.trigger == *input + if self.trigger == *input && self.mods == mods && mode.contains(self.mode) - && !mode.intersects(self.notmode) + && !mode.intersects(self.notmode) { + trace!("Hit trigger on {:#?}, {:#?}", input, mode); + true + } else { + false + } } #[inline] -- cgit