This commit is contained in:
Julian Schuler 2025-07-16 20:33:56 -07:00 committed by GitHub
commit d9cadf6ec2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 2 deletions

View File

@ -347,6 +347,10 @@ void apply_combo(uint16_t combo_index, combo_t *combo) {
qrecord->combo_index = combo_index; qrecord->combo_index = combo_index;
ACTIVATE_COMBO(combo); ACTIVATE_COMBO(combo);
if (key_count == 1) {
release_combo(combo_index, combo);
}
break; break;
} else { } else {
// key was part of the combo but not the last one, "disable" it // key was part of the combo but not the last one, "disable" it

View File

@ -54,3 +54,18 @@ TEST_F(Combo, combo_osmshift_tapped) {
tap_key(key_i); tap_key(key_i);
VERIFY_AND_CLEAR(driver); VERIFY_AND_CLEAR(driver);
} }
TEST_F(Combo, combo_single_key_twice) {
TestDriver driver;
KeymapKey key_a(0, 0, 1, KC_A);
set_keymap({key_a});
EXPECT_REPORT(driver, (KC_B));
tap_combo({key_a});
VERIFY_AND_CLEAR(driver);
EXPECT_REPORT(driver, (KC_B));
EXPECT_EMPTY_REPORT(driver);
tap_combo({key_a});
VERIFY_AND_CLEAR(driver);
}

View File

@ -4,14 +4,16 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include "quantum.h" #include "quantum.h"
enum combos { modtest, osmshift }; enum combos { modtest, osmshift, single_key };
uint16_t const modtest_combo[] = {KC_Y, KC_U, COMBO_END}; uint16_t const modtest_combo[] = {KC_Y, KC_U, COMBO_END};
uint16_t const osmshift_combo[] = {KC_Z, KC_X, COMBO_END}; uint16_t const osmshift_combo[] = {KC_Z, KC_X, COMBO_END};
uint16_t const single_key_combo[] = {KC_A, COMBO_END};
// clang-format off // clang-format off
combo_t key_combos[] = { combo_t key_combos[] = {
[modtest] = COMBO(modtest_combo, RSFT_T(KC_SPACE)), [modtest] = COMBO(modtest_combo, RSFT_T(KC_SPACE)),
[osmshift] = COMBO(osmshift_combo, OSM(MOD_LSFT)) [osmshift] = COMBO(osmshift_combo, OSM(MOD_LSFT)),
[single_key] = COMBO(single_key_combo, KC_B),
}; };
// clang-format on // clang-format on