Fix isActive(key)

The `OneShot.isActive(key)` method was returning true even if a key timed out,
when `OneShot.isActive()` already returned false. It now takes the timeout into
consideration too.

Signed-off-by: Gergely Nagy <kaleidoscope@gergo.csillger.hu>
pull/389/head
Gergely Nagy 7 years ago
parent 6fbcf4ec5d
commit e9c03b5fd8

@ -213,6 +213,11 @@ bool OneShot::isActive(void) {
return (state_.all && !hasTimedOut());
}
bool OneShot::isActive(Key key) {
uint8_t idx = key.raw - ranges::OS_FIRST;
return bitRead(state_.all, idx) && !hasTimedOut();
}
bool OneShot::isModifierActive(Key key) {
if (key.raw < Key_LeftControl.raw || key.raw > Key_RightGui.raw)
return false;

@ -36,10 +36,7 @@ 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 bool isActive(Key key);
static void cancel(bool with_stickies);
static void cancel(void) {
cancel(false);

Loading…
Cancel
Save