From 6fbcf4ec5dc0a7b5fbbadbb04971ab69fdcdc76e Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Wed, 16 Aug 2017 09:48:58 +0200 Subject: [PATCH] Add a `OneShot.isActive(key)` method Signed-off-by: Gergely Nagy --- src/Kaleidoscope/OneShot.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Kaleidoscope/OneShot.h b/src/Kaleidoscope/OneShot.h index 35ed6862..ba60240a 100644 --- a/src/Kaleidoscope/OneShot.h +++ b/src/Kaleidoscope/OneShot.h @@ -36,6 +36,10 @@ class OneShot : public KaleidoscopePlugin { return (key.raw >= kaleidoscope::ranges::OS_FIRST && key.raw <= kaleidoscope::ranges::OS_LAST); } static bool isActive(void); + static bool isActive(Key key) { + uint8_t idx = key.raw - ranges::OS_FIRST; + return bitRead(state_.all, idx); //&& !hasTimedOut(); + } static void cancel(bool with_stickies); static void cancel(void) { cancel(false);