wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
17.19k stars 777 forks source link

Kitty keyboard: keys not reported as escape keys #5147

Open plaukiu opened 7 months ago

plaukiu commented 7 months ago

What Operating System(s) are you seeing this problem on?

macOS

Which Wayland compositor or X11 Window manager(s) are you using?

No response

WezTerm version

WezTerm-macos-20240226-174525-22424c32

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

Kitty keyboard protocol has an enhancement to map all keys to CSIu sequences. This includes text keys and modifier keys.

Wezterm ignores this flag.

To Reproduce

  1. Request 'report all keys as escape codes' kitty enhancement (e.g. CSI > 1 5 ; 1 u) in a host application.
  2. Press some key.
  3. Observe how ASCII codes are received.
  4. Observe how modifier keys do not produce events.

Configuration

config.enable_kitty_keyboard = true

Expected Behavior

Kitty

9 7 u
5 7 4 4 2 u
9 1 ; 5 u

Wezterm

97
27

Logs

No response

Anything else?

As a matter of fact, none of the enhancements behave the same in Wezterm as in Kitty.

cstrahan commented 7 months ago

Related:

The kitten executable bundled with kitty might be helpful for debugging the differences.

For example, consider holding shift and typing 'a' (i.e. A).

Within kitty, if I run kitten show_key -m kitty (the kitten binary is included with kitty) and hold shift, type a, and release shift, I see:

shift+LEFT_SHIFT PRESS 
CSI 57441 ; 2 u

shift+a PRESS A
CSI 97 : 65 ; 2 ; 65 u
Shifted key: A 

shift+a RELEASE 
CSI 97 : 65 ; 2 : 3 u
Shifted key: A 

LEFT_SHIFT RELEASE 
CSI 57441 ; 1 : 3 u

When I run kitten show_key -m kitty In wezterm and repeat the above, I see:

a PRESS A
CSI 97 : 65 ; 1 ; 65 u
Shifted key: A

shift+a RELEASE
CSI 97 : 65 ; 2 : 3 u
Shifted key: A