Compare commits

...
2 Commits
Author SHA1 Message Date
Sergey Vlasov da6e888a32 Do not leak weak mods from tap dance to the interrupting keypress (#12471)
Tap dance callbacks may register weak mods; one case when it happens
is when a tap dance registers a key with modifiers.  When the tap
dance is interrupted by pressing another key, these weak mods could
affect the interrupting key (normally any stale weak mods are cleared
at the start of action_exec() when handling a keypress event, but the
tap dance interrupt check code is called later, and the weak mods left
by that code were not cleared).  Add another clear_weak_mods() call to
preprocess_tap_dance() to make sure that the interrupting keypress is
not affected by unrelated weak mods from the previous tap dance.

Fixes #12445.
2021-04-25 13:41:37 +10:00
github-actions[bot]andQMK Bot d3bf3d3b1c Format code according to conventions (#12681)
Co-authored-by: QMK Bot <[email protected]>
2021-04-25 13:15:48 +10:00
2 changed files with 6 additions and 2 deletions

No files matched your search

@@ -117,6 +117,10 @@ void preprocess_tap_dance(uint16_t keycode, keyrecord_t *record) {
action->state.interrupting_keycode = keycode; action->state.interrupting_keycode = keycode;
process_tap_dance_action_on_dance_finished(action); process_tap_dance_action_on_dance_finished(action);
reset_tap_dance(&action->state); reset_tap_dance(&action->state);
// Tap dance actions can leave some weak mods active (e.g., if the tap dance is mapped to a keycode with
// modifiers), but these weak mods should not affect the keypress which interrupted the tap dance.
clear_weak_mods();
} }
} }
} }
+2 -2
View File
@@ -953,8 +953,8 @@ int8_t sendchar(uint8_t c) {
*/ */
const sysinterval_t timeout = timed_out ? TIME_IMMEDIATE : TIME_MS2I(5); const sysinterval_t timeout = timed_out ? TIME_IMMEDIATE : TIME_MS2I(5);
const size_t result = chnWriteTimeout(&drivers.console_driver.driver, &c, 1, timeout); const size_t result = chnWriteTimeout(&drivers.console_driver.driver, &c, 1, timeout);
timed_out = (result == 0); timed_out = (result == 0);
return result; return result;
} }