Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic on XF86 keycodes #4125

Closed
emilyyyylime opened this issue Oct 6, 2022 · 7 comments · Fixed by #4887
Closed

Panic on XF86 keycodes #4125

emilyyyylime opened this issue Oct 6, 2022 · 7 comments · Fixed by #4887
Labels
C-bug Category: This is a bug upstream

Comments

@emilyyyylime
Copy link
Contributor

emilyyyylime commented Oct 6, 2022

Summary

I know this is kind of an edge case, but if your system does not do anything with volume control/media playback control keys, they pass through to Helix, causing a panic with the following message:

thread 'main' panicked at 'internal error: entered unreachable code: Shouldn't get this key without enabling DISAMBIGUATE_ESCAPE_CODES in crossterm', helix-view/src/keyboard.rs:158:40
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Reproduction Steps

So this wouldn't be too easy if you don't have access to the guts of your operating system and desktop environment or window manager, but with i3 you can edit your config and comment any line that starts with bindsym XF86____, save it and reload your config, then in Helix send to your PC (presumably with a keyboard button) the keycode corresponding to what you just commented out.

Helix log

The log didn't contain anything in regards to this error

Platform

EndeavourOS Arch Linux with i3-gaps

Terminal Emulator

Kitty

Helix Version

helix 22.08.1 (5dbca0f)

@emilyyyylime emilyyyylime added the C-bug Category: This is a bug label Oct 6, 2022
@sudormrfbin
Copy link
Member

This is probably an upstream bug since we indeed don't have DISAMBIGUATE_ESCAPE_CODES enabled which seems to be the prerequisite to getting the Media keycodes which is where the code panics:

| CKeyCode::Media(_)
| CKeyCode::Modifier(_) => unreachable!(
"Shouldn't get this key without enabling DISAMBIGUATE_ESCAPE_CODES in crossterm"
),

@ngraham20
Copy link
Contributor

Looks like this also happens when I press the "Pause" key (different than the play/pause media key)

@emilyyyylime
Copy link
Contributor Author

@ngraham20 yeah it's a problem with all media control keys, not just play/pause. It's also Mute, Next tack, Previous track, Volume up/down, etc.

@cor
Copy link
Contributor

cor commented Nov 2, 2022

Same issue here, specifically when I use NixOS inside of a Parallels VM with macOS as the host OS, and then proceed to change the volume with my keyboard on macOS.

@groves
Copy link
Contributor

groves commented Nov 3, 2022

@ngraham20 and @cor, are you using kitty as your terminal emulator, too? Or another terminal?

groves added a commit to groves/helix that referenced this issue Nov 3, 2022
It seems like we get media play/pause/mute/etc keys despite not
emitting DISAMBIGUATE_ESCAPE_CODES(helix-editor#4125).

Make crossterm::event::KeyCode a TryInto for KeyCode instead of Into to
let us ignore keys we don't care about.
@groves
Copy link
Contributor

groves commented Nov 3, 2022

I believe #4576 should keep us from panicking on media keys. Could I get someone experiencing the issue to try that branch? kitty isn't sending media keys through for me, so I wasn't able to repro this.

groves added a commit to groves/helix that referenced this issue Nov 3, 2022
It seems like we get media play/pause/mute/etc keys despite not
emitting DISAMBIGUATE_ESCAPE_CODES(helix-editor#4125).

Make crossterm::event::KeyCode a TryInto for KeyCode instead of Into to
let us ignore keys we don't care about.
@emilyyyylime
Copy link
Contributor Author

@groves Just tried it with XF86AudioMute and it worked! nice job 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug upstream
Projects
None yet
5 participants