fix: finalize stacked held modifiers (S_HOLD_RELEASE timeout) - #58
Merged
Merged
Conversation
A held key released while another key is stacked on top entered SMTD_STAGE_HOLD_RELEASE but never scheduled a deferred, so the state hung forever and its modifier stayed registered. Schedule the (previously dead) timeout_hold_release callback with the release term, mirroring SMTD_STAGE_TOUCH_RELEASE. Fixes the 4 failing test_stirred_long_mod_smtd_press2_fixed assertions in caps_word_enable and complex_layout suites.
stasmarkin
added a commit
that referenced
this pull request
Jun 16, 2026
… fix - Fix: SMTD_LT now uses native QMK layer_on/layer_off instead of the old LAYER_PUSH/LAYER_RESTORE (layer_move) macros. Layer activation is additive and no longer wipes foreign layer bits on release - fixes #57: a TG()/TO() toggled layer held alongside an SMTD_LT stays on after the SMTD_LT is released - unblocks #44: two SMTD_LT layers can coexist, so a tri-layer layer_state_set hook can light up the third layer - Fix: a held key released while another key is stacked on top now schedules timeout_hold_release, so the state finalizes and its modifier is released instead of hanging forever (fixes #58) - Tests: regression coverage for layer interaction in tests/unit/layer_features
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Проблема
Постоянно падали 4 ассерта в unit-тестах
test_stirred_long_mod_smtd_press2_fixed(наборыcaps_word_enableиcomplex_layout).Сценарий: два мода зажаты стопкой (
CTRL→ стадияS_HOLD, сверху держитсяMT1), затем нижнийCTRLотпускают, покаMT1ещё активен. ВSMTD_STAGE_HOLDотпускание не-верхнего состояния переводит его вSMTD_STAGE_HOLD_RELEASE, ноsmtd_apply_stageдля этой стадии не планировалdefer_exec— состояние зависало навсегда, а его модификатор оставался зарегистрированным.Это не только ломало тесты, но и реальный баг прошивки: нижний из двух зажатых модификаторов застревал в нажатом состоянии.
Причина
Функция
timeout_hold_releaseбыла определена, но нигде не использовалась — потерянный кусок исходного дизайна. По замыслуSMTD_STAGE_HOLD_RELEASEдолжен планировать её, чтобы зависший зажатый мод финализировался по release-терму.Фикс
В
smtd_apply_stage, веткаSMTD_STAGE_HOLD_RELEASE, добавлено планированиеtimeout_hold_releaseс release-термом — по аналогии с уже существующимSMTD_STAGE_TOUCH_RELEASE.Тесты
Итого 168 тестов зелёные, exit code 0.