Fix for One Shot Layer not being cleaned up after some actions (#8832)

This commit is contained in:
Joshua Diamond 2020-06-18 03:07:48 -04:00 committed by GitHub
parent f7eb030e91
commit 9c1097e768
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -192,7 +192,14 @@ void process_record(keyrecord_t *record) {
return; return;
} }
if (!process_record_quantum(record)) return; if (!process_record_quantum(record)) {
#ifndef NO_ACTION_ONESHOT
if (is_oneshot_layer_active() && record->event.pressed) {
clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
}
#endif
return;
}
process_record_handler(record); process_record_handler(record);
post_process_record_quantum(record); post_process_record_quantum(record);
@ -231,7 +238,7 @@ void process_action(keyrecord_t *record, action_t action) {
#ifndef NO_ACTION_ONESHOT #ifndef NO_ACTION_ONESHOT
bool do_release_oneshot = false; bool do_release_oneshot = false;
// notice we only clear the one shot layer if the pressed key is not a modifier. // notice we only clear the one shot layer if the pressed key is not a modifier.
if (is_oneshot_layer_active() && event.pressed && !IS_MOD(action.key.code) if (is_oneshot_layer_active() && event.pressed && (action.kind.id == ACT_USAGE || !IS_MOD(action.key.code))
# ifdef SWAP_HANDS_ENABLE # ifdef SWAP_HANDS_ENABLE
&& !(action.kind.id == ACT_SWAP_HANDS && action.swap.code == OP_SH_ONESHOT) && !(action.kind.id == ACT_SWAP_HANDS && action.swap.code == OP_SH_ONESHOT)
# endif # endif