host_keymap: a present-but-empty / "None" [KeyMap] line is an explicit unbind

host_keymap_load zeroed an action's binds when its line was present and then
apply_defaults() put the built-in key straight back, so "Turbo = None" (or
an empty value) silently re-armed Tab. Track explicit_unbound per action:
set when the line is present but yields no binds, and honoured by
apply_defaults through want_default(). A missing line still receives the
default, so existing config.ini files are unaffected.

Pairs with the launcher's Backspace-to-clear (recomp-ui
feat/additional-ui-functionality), which writes "None" for that reason.
README documents the rule; test_rewind_toggle_combo.py guards it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Kevin
2026-09-04 07:01:14 -04:00
parent 15822694c6
commit 975f6646ef
3 changed files with 33 additions and 11 deletions
@@ -75,5 +75,11 @@ KEYMAP_C = (ROOT / "runtime" / "src" / "host_keymap.c").read_text(encoding="utf-
assert "HOST_KEYMAP_TURBO_TOGGLE," in KEYMAP_H
assert 'ieq(name, "TurboToggle")' in KEYMAP_C
assert "add_bind(HOST_KEYMAP_TURBO_TOGGLE, (int)SDLK_F9" in KEYMAP_C
# A present-but-empty / "None" [KeyMap] line is an explicit unbind: no
# built-in default is re-applied for that action (launcher Backspace-to-clear).
assert "int explicit_unbound;" in KEYMAP_C
assert "static int want_default(HostKeymapAction action)" in KEYMAP_C
assert "s_actions[HOST_KEYMAP_TURBO].count == 0" not in KEYMAP_C
assert "if (want_default(HOST_KEYMAP_TURBO))" in KEYMAP_C
print("host shortcut guard passed")