mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-17 21:22:05 +00:00
Merge 1366509a6b
into 507c948ed8
This commit is contained in:
commit
d9cadf6ec2
@ -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
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user