helix icon indicating copy to clipboard operation
helix copied to clipboard

Panic on XF86 keycodes

Open emilyyyylime opened this issue 1 year ago • 7 comments

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 (5dbca0fc)

emilyyyylime avatar Oct 06 '22 15:10 emilyyyylime

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:

https://github.com/helix-editor/helix/blob/4d4be0e880efd136100439cc34e8c526d299ec34/helix-view/src/keyboard.rs#L157-L160

sudormrfbin avatar Oct 06 '22 17:10 sudormrfbin

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

ngraham20 avatar Oct 16 '22 20:10 ngraham20

@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.

emilyyyylime avatar Oct 17 '22 08:10 emilyyyylime

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.

cor avatar Nov 02 '22 16:11 cor

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

groves avatar Nov 03 '22 08:11 groves

I believe https://github.com/helix-editor/helix/pull/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 avatar Nov 03 '22 09:11 groves

@groves Just tried it with XF86AudioMute and it worked! nice job :+1:

emilyyyylime avatar Nov 03 '22 11:11 emilyyyylime