alacritty / alacritty

A cross-platform, OpenGL terminal emulator.
https://alacritty.org
Apache License 2.0
53.72k stars 2.94k forks source link

Unable to produce "C-x C-;" keybind instead gets "C-x ;" whilst control is held down the whole time #7941

Closed Inc0n closed 1 month ago

Inc0n commented 1 month ago

Trying out emacs in alacritty and unable to produce "C-x C-;" whilst control is held down the whole time.

Is this by design or certain restriction in place, is this configurable in any capacity?

System

OS: Linux Version: alacritty 0.14.0-dev Linux/BSD: X11, i3

Logs

[1.531146010s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 694630, tv_nsec: 225423394 }, requested_resume: None })
[1.531543036s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(102760453)), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), event: KeyEvent { physical_key: Code(ControlLeft), logical_key: Named(Control), text: None, location: Left, state: Pressed, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(Control), text_with_all_modifiers: None } }, is_synthetic: false } }
[1.531584171s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(102760453)), event: ModifiersChanged(Modifiers { state: ModifiersState(CONTROL), pressed_mods: ModifiersKeys(0x0) }) }
[1.531604922s] [INFO ] [alacritty] winit event: AboutToWait
[1.570201912s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 694631, tv_nsec: 541184775 }, requested_resume: None })
[1.570341419s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(102760453)), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), event: KeyEvent { physical_key: Code(KeyX), logical_key: Character("x"), text: Some("x"), location: Standard, state: Pressed, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Character("x"), text_with_all_modifiers: Some("\u{18}") } }, is_synthetic: false } }
[1.570373944s] [INFO ] [alacritty] winit event: AboutToWait
[1.677418991s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 694631, tv_nsec: 579965105 }, requested_resume: None })
[1.677536904s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(102760453)), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), event: KeyEvent { physical_key: Code(Semicolon), logical_key: Character(";"), text: Some(";"), location: Standard, state: Pressed, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Character(";"), text_with_all_modifiers: Some(";") } }, is_synthetic: false } }
[1.677584487s] [INFO ] [alacritty] winit event: AboutToWait

It's also the same with showkey -a:

^X   24 0030 0x18
;    59 0073 0x3b
kchibisov commented 1 month ago

you need to somehow enable kitty keyboard protocol in emacs. The default behavior is correct (as in showkey).

nixpulvis commented 1 month ago

Just because I'm curious. Is the default behavior something specific to characters like ; or is this something about needing to separate the control presses?

chrisduerr commented 1 month ago

Is the default behavior something specific to characters like ; or is this something about needing to separate the control presses?

The characters sent for control key are specified for each individual key and are specific to that key. Not all keys have a "control representation" and ; is one of them.

Inc0n commented 4 weeks ago

The only kitty keyboard protocol package I can find is https://github.com/benjaminor/kkp, which does not support alacritty. Is there another approach for this issue?

kchibisov commented 4 weeks ago

I wonder why it need to support alacritty in the first place, the protocol is standard, and you query for it with a standard escape sequence. Well, if they check TERM that will be unfortunate, but maybe you can somehow send a patch to them or force it.

Because the handling is the same as in e.g. kitty.

Inc0n commented 4 weeks ago

Yes you are right, the protocol is standard. I have found out there is more information on https://sw.kovidgoyal.net/kitty/keyboard-protocol/. It conveniently points out that its support in alacritty is found here "The alacritty terminal".

As to how to make C-x C-; whilst Control is held down interpreted as C-x C-; instead of C-x ; I shall report back in due time......