1
0
Fork 0

Fix Caps Word capitalization when used with Combos + Auto Shift. (#17549)

This commit is contained in:
Pascal Getreuer 2022-08-13 06:48:51 -07:00 committed by GitHub
parent 4eeafbebab
commit 6a0d90f81a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 343 additions and 15 deletions

View file

@ -123,7 +123,12 @@ bool get_autoshift_shift_state(uint16_t keycode) {
/** \brief Restores the shift key if it was cancelled by Auto Shift */
static void autoshift_flush_shift(void) {
autoshift_flags.holding_shift = false;
del_weak_mods(MOD_BIT(KC_LSFT));
# ifdef CAPS_WORD_ENABLE
if (!is_caps_word_on())
# endif // CAPS_WORD_ENABLE
{
del_weak_mods(MOD_BIT(KC_LSFT));
}
if (autoshift_flags.cancelling_lshift) {
autoshift_flags.cancelling_lshift = false;
add_mods(MOD_BIT(KC_LSFT));

View file

@ -131,7 +131,11 @@ bool process_caps_word(uint16_t keycode, keyrecord_t* record) {
#endif // SWAP_HANDS_ENABLE
}
#ifdef AUTO_SHIFT_ENABLE
del_weak_mods(get_autoshift_state() ? ~MOD_BIT(KC_LSFT) : 0xff);
#else
clear_weak_mods();
#endif // AUTO_SHIFT_ENABLE
if (caps_word_press_user(keycode)) {
send_keyboard_report();
return true;

View file

@ -227,7 +227,16 @@ static inline void dump_key_buffer(void) {
#endif
}
record->event.time = 0;
#if defined(CAPS_WORD_ENABLE) && defined(AUTO_SHIFT_ENABLE)
// Edge case: preserve the weak Left Shift mod if both Caps Word and
// Auto Shift are on. Caps Word capitalizes by setting the weak Left
// Shift mod during the press event, but Auto Shift doesn't send the
// key until it receives the release event.
del_weak_mods((is_caps_word_on() && get_autoshift_state()) ? ~MOD_BIT(KC_LSFT) : 0xff);
#else
clear_weak_mods();
#endif // defined(CAPS_WORD_ENABLE) && defined(AUTO_SHIFT_ENABLE)
#if TAP_CODE_DELAY > 0
// only delay once and for a non-tapping key