Summary
In src/config.cpp, register_press_combo / register_hold_combo pre-parse default_value into current_combos (lines ~998-1004) and then call register_key_combo, which re-parses the same default_value_str. This causes duplicate WARNING logs when the C++ literal default contains a typo (e.g. register_press_combo(..., "ctrl+xyzzy")).
Root cause
register_key_combo synchronously invokes the setter at line 985 with the re-parsed default. Passing "" to avoid the double-parse regresses behavior: the closure immediately clobbers the pre-parsed current_combos with an empty list, so the binding has no keys unless the INI overrides it.
Proposed fix (Option 2 — cleanest)
Add a pre-parsed-default overload on register_key_combo that accepts a KeyComboList directly instead of string_view, so callers that have already parsed the default can skip the re-parse step:
// New overload
bool register_key_combo(
std::string_view section,
std::string_view key,
KeyComboList parsed_default, // pre-parsed
std::string_view log_key_name,
std::function<void(KeyComboList)> setter
);
register_press_combo / register_hold_combo would call this overload after their existing parse, eliminating the double-parse and the spurious WARNING.
Alternatives considered
- Skip-initial-seed flag in the closure — works but adds shared mutable state for a developer-error edge case.
- Reorder
register_press before register_key_combo + skip-seed flag — still needs the flag.
Impact of the current behavior
- Fires only on C++ literal typos in
default_value, once at process startup, and only when the INI does not override the key.
- Self-correcting: warning vanishes once the developer fixes the typo.
- User-supplied INI typos go through a single parse path (one WARNING, as documented).
References
Target milestone
v3.2.4
Summary
In
src/config.cpp,register_press_combo/register_hold_combopre-parsedefault_valueintocurrent_combos(lines ~998-1004) and then callregister_key_combo, which re-parses the samedefault_value_str. This causes duplicate WARNING logs when the C++ literal default contains a typo (e.g.register_press_combo(..., "ctrl+xyzzy")).Root cause
register_key_combosynchronously invokes the setter at line 985 with the re-parsed default. Passing""to avoid the double-parse regresses behavior: the closure immediately clobbers the pre-parsedcurrent_comboswith an empty list, so the binding has no keys unless the INI overrides it.Proposed fix (Option 2 — cleanest)
Add a pre-parsed-default overload on
register_key_combothat accepts aKeyComboListdirectly instead ofstring_view, so callers that have already parsed the default can skip the re-parse step:register_press_combo/register_hold_combowould call this overload after their existing parse, eliminating the double-parse and the spurious WARNING.Alternatives considered
register_pressbeforeregister_key_combo+ skip-seed flag — still needs the flag.Impact of the current behavior
default_value, once at process startup, and only when the INI does not override the key.References
Target milestone
v3.2.4