Skip to content

F13–F24 function keys panic the app (key.rs from_f) #332

Description

@Ritze03

Describe the bug

Pressing any function key above F12 (F13–F24) crashes spotatui with a panic.

I use F13–F24 as global hotkeys in my setup, and when spotatui happens to be the focused window, hitting one of them by accident takes down the whole app instead of being ignored.

The panic comes from Key::from_f in src/tui/event/key.rs, which only maps F0–F12 and panics on anything higher:

// src/tui/event/key.rs
_ => panic!("unknown function key: F{}", n),

crossterm emits KeyCode::F(n) for n up to 24, and the From<KeyEvent> impl forwards every function key into from_f, so F13–F24 hit the panic arm.

To Reproduce
Steps to reproduce the behavior:

  1. Launch spotatui and keep it focused.
  2. Press F13 (or any function key F13–F24) — e.g. via a hotkey bound to one of those keys.
  3. See the app panic:
thread '<unnamed>' panicked at src/tui/event/key.rs:93:12:
unknown function key: F24

Expected behavior

Function keys that aren't bound to anything should be ignored, the same as any other unhandled key — not crash the application.

Screenshots
N/A

Desktop (please complete the following information):

  • OS: Linux
  • Terminal: kitty + zsh
  • Version: 0.40.0

Additional context

Fixed locally by mapping the unmapped range to the existing Key::Unknown catch-all instead of panicking (spotatui binds nothing to F13–F24). Happy to open a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions