From e5ba44a6da99db089e8181f543e150138bde7d35 Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Tue, 17 Nov 2020 15:32:17 -0600 Subject: [PATCH] Adapt Escape-OneShot to active keys cache Signed-off-by: Michael Richters --- src/kaleidoscope/plugin/Escape-OneShot.cpp | 8 +++----- src/kaleidoscope/plugin/Escape-OneShot.h | 2 -- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/kaleidoscope/plugin/Escape-OneShot.cpp b/src/kaleidoscope/plugin/Escape-OneShot.cpp index 47078c40..3caeb077 100644 --- a/src/kaleidoscope/plugin/Escape-OneShot.cpp +++ b/src/kaleidoscope/plugin/Escape-OneShot.cpp @@ -23,21 +23,19 @@ namespace kaleidoscope { namespace plugin { -bool EscapeOneShot::did_escape_; - EventHandlerResult EscapeOneShot::onKeyswitchEvent(Key &mapped_key, KeyAddr key_addr, uint8_t keyState) { if (mapped_key != Key_Escape || (keyState & INJECTED)) return EventHandlerResult::OK; - if (did_escape_) - mapped_key = Key_NoKey; - did_escape_ = !keyToggledOff(keyState); + if (!keyToggledOn(keyState)) + return EventHandlerResult::OK; if ((!::OneShot.isActive() || ::OneShot.isPressed()) && !::OneShot.isSticky()) { return EventHandlerResult::OK; } ::OneShot.cancel(true); + mapped_key = Key_NoKey; return EventHandlerResult::EVENT_CONSUMED; } diff --git a/src/kaleidoscope/plugin/Escape-OneShot.h b/src/kaleidoscope/plugin/Escape-OneShot.h index 027dabf6..af214228 100644 --- a/src/kaleidoscope/plugin/Escape-OneShot.h +++ b/src/kaleidoscope/plugin/Escape-OneShot.h @@ -27,8 +27,6 @@ class EscapeOneShot : public kaleidoscope::Plugin { EventHandlerResult onKeyswitchEvent(Key &mapped_key, KeyAddr key_addr, uint8_t keyState); - private: - static bool did_escape_; }; } }