Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix space cadet auto shift interaction #24440

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions quantum/quantum.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,15 +364,15 @@ bool process_record_quantum(keyrecord_t *record) {
#ifdef LEADER_ENABLE
process_leader(keycode, record) &&
#endif
#ifdef SPACE_CADET_ENABLE
process_space_cadet(keycode, record) &&
#endif
#ifdef AUTO_SHIFT_ENABLE
process_auto_shift(keycode, record) &&
#endif
#ifdef DYNAMIC_TAPPING_TERM_ENABLE
process_dynamic_tapping_term(keycode, record) &&
#endif
#ifdef SPACE_CADET_ENABLE
process_space_cadet(keycode, record) &&
#endif
#ifdef MAGIC_ENABLE
process_magic(keycode, record) &&
#endif
Expand Down
28 changes: 28 additions & 0 deletions tests/auto_shift/test_auto_shift.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2021 Stefan Kerkmann

Check failure on line 1 in tests/auto_shift/test_auto_shift.cpp

View workflow job for this annotation

GitHub Actions / lint

Requires Formatting
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -68,3 +68,31 @@
run_one_scan_loop();
VERIFY_AND_CLEAR(driver);
}

AndrewMoscoe marked this conversation as resolved.
Show resolved Hide resolved

// test auto shift and space cadet interaction
// press shift, press key, release shift, release key
// the right interaction is we only get the shifted key
// the wrong interaction is we get a bracket and a shifted key
TEST_F(AutoShift, key_release_after_timeout) {
AndrewMoscoe marked this conversation as resolved.
Show resolved Hide resolved
TestDriver driver;
InSequence s;
auto left_shift = KeymapKey(0, 0, 0, SC_LSPO);
auto key_a = KeymapKey(0, 1, 0, KC_A);
AndrewMoscoe marked this conversation as resolved.
Show resolved Hide resolved

set_keymap({regular_key});
AndrewMoscoe marked this conversation as resolved.
Show resolved Hide resolved

/* Press regular key */
EXPECT_NO_REPORT(driver);
left_shift.press();
key_a.press();
left_shift.release();
key_a.release();
VERIFY_AND_CLEAR(driver);

/* Release regular key */
EXPECT_REPORT(driver, (KC_LSFT, KC_A));
EXPECT_EMPTY_REPORT(driver);
run_one_scan_loop();
VERIFY_AND_CLEAR(driver);
}
Loading