diff --git a/docs/NEWS.md b/docs/NEWS.md index 3326b470..d6c7bdef 100644 --- a/docs/NEWS.md +++ b/docs/NEWS.md @@ -20,8 +20,9 @@ the output, particularly when typing fast: - `Qukeys.setMinimumHoldTime(ms)` sets the minimum duration of a qukey press required for it to be eligible to take on its alternate (modifier) value. - `Qukeys.setMinimumPriorInterval(ms)` sets the minimum interval between the - previous non-modifier key press and the press of the qukey required to make - the qukey eligible to take on its alternate (modifier) value. + previous printable (letters, numbers, and punctuation) key press and the press + of the qukey required to make the qukey eligible to take on its alternate + (modifier) value. ### KALEIDOSCOPE_API_VERSION bump diff --git a/src/kaleidoscope/plugin/Qukeys.cpp b/src/kaleidoscope/plugin/Qukeys.cpp index f6ec29af..b5da1cab 100644 --- a/src/kaleidoscope/plugin/Qukeys.cpp +++ b/src/kaleidoscope/plugin/Qukeys.cpp @@ -185,7 +185,7 @@ bool Qukeys::processQueue() { // key, so we don't need to do it repeatedly later. bool qukey_is_spacecadet = isModifierKey(queue_head_.primary_key); - // If the qukey press followed a non-modifier key too closely, it's not + // If the qukey press is followed a printable key too closely, it's not // eligible to take on its alternate value unless it's a SpaceCadet-type key. if (!Runtime.hasTimeExpired(prior_keypress_timestamp_, minimum_prior_interval_) && @@ -291,8 +291,13 @@ void Qukeys::flushEvent(Key event_key) { KeyAddr queue_head_addr = event_queue_.addr(0); uint8_t keyswitch_state = event_queue_.isRelease(0) ? WAS_PRESSED : IS_PRESSED; - // If the flushed event is a keypress of a non-modifier, record its timestamp: - if (!event_queue_.isRelease(0) && !isModifierKey(event_key)) { + // If the flushed event is a keypress of a printable symbol, record its + // timestamp. This lets us suppress some unintended alternate values seen by + // fast typists by requiring a minimum interval between this keypress and the + // next qukey press in order for that qukey to become alternate-eligible. + if (!event_queue_.isRelease(0) && + ((event_key >= Key_A && event_key <= Key_0) || + (event_key >= Key_Minus && event_key <= Key_Slash))) { prior_keypress_timestamp_ = event_queue_.timestamp(0); }