Skip to content

Settings shows F-keys and Home/End as [unknown] and misses conflicts #596

Closed

Description

@LargeModGames

What

The Keybindings tab in Settings shows [unknown] for any key bound to F0 to F12, Home, End, Tab or Ins. The default Toggle Playback row reads [ ], because Space prints as a bare space. The F-key and Home/End case is worse than a bad label. The conflict check reads each row's text back as a key, "unknown" doesn't parse, so the check skips that row. I hit it by binding Help to F5, saving with Alt-s, reopening Settings and binding Search to F5 as well. There was no "already assigned" error, and after saving both actions were on F5. A config.yml with help: f1 under keybindings: shows [unknown] from the start.

Where to look

  • The local key_to_string inside load_settings_for_category in src/core/app/settings_schema.rs. It has no arm for Space, Tab, Home, End, Ins or F0 to F12 and ends in _ => "unknown". All the keys.* rows use it.
  • key_to_config_string, handle_key_edit and check_keybinding_conflict in src/tui/handlers/settings.rs. key_to_config_string is the complete mapping, used when you capture a key.
  • parse_key / parse_key_public in src/core/user_config.rs, and the key_to_config_string closure in UserConfig::save_config in the same file (a third copy).
  • The SettingValue::Key arm in src/tui/ui/settings.rs that draws [{}].

Possible solution

  • Move key_to_config_string from src/tui/handlers/settings.rs to src/core/user_config.rs as pub fn key_to_config_string(key: &Key) -> String, next to parse_key_public. Keep the handler's version as the body. It has no _ arm, so a new Key variant becomes a compile error instead of another "unknown".
  • Call it from handle_key_edit and from load_settings_for_category, and delete the local key_to_string. Switching the save_config closure and plugin_key_string in src/tui/handlers/plugin_screen.rs over to it is optional.
  • The shared fn must live in core, never in tui/. settings_schema.rs builds on the headless telemetry CI leg, where mod tui doesn't exist. cargo clippy --no-default-features --features telemetry -- -D warnings checks that leg.
  • settings_schema.rs is a child of core/app/. It opens with use super::*; and has no other top-level imports. Call the fn by full path (crate::core::user_config::key_to_config_string(&key)) or add it to the crate::core::user_config import in src/core/app/mod.rs. Don't add a use line to settings_schema.rs.
  • Space will read [space] instead of [ ]. That's intended, it's what save_config writes to config.yml.
  • Tests in the mod tests of src/core/app/settings_schema.rs:
    • keybinding_rows_spell_keys_the_way_config_yml_does: App::default(), set app.user_config.keys.help = Key::F5 and app.user_config.keys.search = Key::Home, set app.view.settings_category = SettingsCategory::Keybindings, call app.load_settings_for_category(). The keys.help row is SettingValue::Key("f5".to_string()), keys.search is "home", and keys.toggle_playback is "space". SettingValue derives PartialEq, so assert_eq! works.
    • every_key_row_parses_back_as_a_key: same setup. Every row whose id starts with "keys." holds a string that crate::core::user_config::parse_key_public accepts. This fails on main for the F5 and Home rows.
  • In the mod tests of src/core/user_config.rs: config_string_round_trips_through_parse_key. That module has no use super::*;, so import super::{key_to_config_string, parse_key} and crate::core::input::Key inside the test like test_parse_key does. For Key::Char(' '), Char('a'), Ctrl('d'), Alt('x'), Tab, Home, End, Ins, F0, F5, F12, PageUp, Delete and Esc, parse_key(key_to_config_string(&k)).unwrap() gives k back. Leave out Key::Unknown (it writes "unknown" on purpose).
  • In the mod tests of src/tui/handlers/settings.rs: capturing_a_key_already_bound_elsewhere_is_refused_after_a_reload. Walk the real path with the open_settings and setting_index helpers there. Set app.view.settings_category = SettingsCategory::Keybindings, open Settings, select keys.help, call handler(Key::Enter, &mut app) then handler(Key::F5, &mut app), then app.apply_settings_changes() and reload_category(&mut app). Now select keys.search, press Enter, then F5. The Search row still holds "/" and app.api_error() contains "already assigned to Help".
  • Don't write app.user_config.keys.help = ... in that handler test. Any app.<field> = line under src/tui/handlers, tests included, raises app_field_writes_in_tui_handlers and the gate fails. The Enter/F5 walk above avoids it.
  • PR fix(config): parse ctrl-- and alt-- keybindings #592 (merged) changed parse_key in src/core/user_config.rs and tools/gates.count, so start from the latest main.
  • Add a line under ### Fixed in the [Unreleased] section of CHANGELOG.md.
  • Each new #[test] raises test_attribute_total in tools/gates.count by one. If the number is off, cargo test fails in src/gates.rs and prints the right one.

Done when

  • cargo test --no-default-features --features telemetry,tui settings and cargo test --no-default-features --features telemetry,tui round_trips_through_parse_key list your new tests.
  • cargo fmt --all -- --check, cargo clippy --no-default-features --features telemetry,tui -- -D warnings and cargo test --no-default-features --features telemetry,tui pass.

Activity

  1. added
    bug
    good first issue
    on Sep 26, 2026
  2. spotatui commented on Sep 26, 2026

    @spotatui
    Contributor

    🎧 spotatui triage

    Auto-triaged with DeepSeek V4-Flash.

    Label: bug
    Likely area: Settings keybindings display and conflict detection

    Summary

    The Keybindings tab in Settings renders [unknown] for any binding to F0–F12, Home, End, Tab or Ins, and Space prints as a blank [ ] for the default Toggle Playback row. Because the conflict check re-reads each row's displayed text as a key, the unparseable unknown string makes it skip those rows, so the user could bind both Help and Search to F5 with no "already assigned" warning and both actions ended up on F5. A config.yml containing help: f1 shows [unknown] immediately, so this affects display and conflict detection for common keys.

    Key points

    • F0–F12, Home, End, Tab and Ins are shown as [unknown] in the Keybindings tab
    • Space prints as a bare space, so the default Toggle Playback row reads [ ]
    • Conflict check re-reads row text; "unknown" doesn't parse so those rows are skipped and conflicts go undetected
    • Repro: bind Help to F5, save with Alt-s, reopen Settings, bind Search to F5 — no "already assigned" error, both end on F5
    • A config.yml with help: f1 under keybindings: shows [unknown] from the start

    What would help

    • OS and terminal
    • spotatui version
    • Whether the duplicate-binding behavior also persists to config.yml

    Possible duplicates

    Compared against the 48 most recently updated open issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issue

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions