Merge pull request #438 from keyboardio/redial/chording-fix

Redial: Improved the way it remembers keys
pull/441/head
Jesse Vincent 6 years ago committed by GitHub
commit c8bead6d5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -23,18 +23,27 @@ namespace plugin {
Key Redial::key;
Key Redial::key_to_redial_;
Key Redial::last_key_;
bool Redial::redial_held_ = false;
EventHandlerResult Redial::onKeyswitchEvent(Key &mapped_key, byte row, byte col, uint8_t key_state) {
if (key == Key_NoKey)
return EventHandlerResult::OK;
if (mapped_key == key) {
if (keyToggledOff(key_state))
key_to_redial_ = last_key_;
mapped_key = key_to_redial_;
redial_held_ = keyIsPressed(key_state);
return EventHandlerResult::OK;
}
if (keyToggledOn(key_state) && shouldRemember(mapped_key)) {
key_to_redial_ = mapped_key;
last_key_ = mapped_key;
if (!redial_held_)
key_to_redial_ = mapped_key;
}
return EventHandlerResult::OK;

@ -35,6 +35,8 @@ class Redial : public kaleidoscope::Plugin {
private:
static Key key_to_redial_;
static Key last_key_;
static bool redial_held_;
};
}

Loading…
Cancel
Save