From 746957c65c52dee061fdfda9e253bffc53913848 Mon Sep 17 00:00:00 2001 From: Nikita Tchayka Date: Sun, 24 Nov 2019 21:55:55 +0000 Subject: [PATCH] Allow turning the toggle key off --- src/event/mod.rs | 1 + src/matcher/scrolling.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/event/mod.rs b/src/event/mod.rs index aeb50da..bc9828a 100644 --- a/src/event/mod.rs +++ b/src/event/mod.rs @@ -63,6 +63,7 @@ pub enum KeyModifier { ALT, META, BACKSPACE, + OFF, } impl Default for KeyModifier { diff --git a/src/matcher/scrolling.rs b/src/matcher/scrolling.rs index 83db187..2d59b19 100644 --- a/src/matcher/scrolling.rs +++ b/src/matcher/scrolling.rs @@ -194,6 +194,7 @@ impl <'a, R: MatchReceiver, M: ConfigManager<'a>> super::Matcher for ScrollingMa let config = self.config_manager.default_config(); if m == config.toggle_key { + if m == KeyModifier::OFF { return } let mut toggle_press_time = self.toggle_press_time.borrow_mut(); if let Ok(elapsed) = toggle_press_time.elapsed() { if elapsed.as_millis() < u128::from(config.toggle_interval) {