wez / wezterm

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

search overlay cannot accept IME input #5333

Closed kenchou closed 1 week ago

kenchou commented 3 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

20240203-110809-5046fc22

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

The search overlay cannot accept IME input.

To Reproduce

  1. press CMD+f to activate the search overlay.
  2. chose Chinese(or Japanese) IME
  3. The Chinese characters produced by the IME are inputted into the command line, instead of in the search overlay.

Configuration

no config. (It should have nothing to do with the config)

Expected Behavior

When the search overlay is activated, IME inputs on it.

Logs

No response

Anything else?

CMD+v Pasting Chinese characters into the search overlay has no issues.

qiao-summer commented 2 months ago

me too,but i can input chinese one by one

kenchou commented 2 months ago

me too,but i can input chinese one by one

Confirmed. Amazing...

gehnmaisoda commented 1 month ago

I am facing the same issue. When I input Japanese, it is recognized as a command line input rather than a search input.

https://github.com/wez/wezterm/assets/30795403/74d0c8ea-bf69-441a-afcf-71d8d2bd16a0

However, if I paste inputs by Cmd + V, it works correctly.

https://github.com/wez/wezterm/assets/30795403/0e1910c8-e0b1-490f-bd9e-a8c0d4ed03e8

I have set use_ime to true.

kenchou commented 1 month ago

https://github.com/wez/wezterm/blob/f5e496ebc233187c076cbb34b3cd0f0c50290f51/wezterm-gui/src/termwindow/keyevent.rs#L723-L741

https://github.com/wez/wezterm/blob/f5e496ebc233187c076cbb34b3cd0f0c50290f51/wezterm-gui/src/termwindow/keyevent.rs#L599-L603

https://github.com/wez/wezterm/blob/f5e496ebc233187c076cbb34b3cd0f0c50290f51/wezterm-gui/src/termwindow/mod.rs#L3298-L3304

Perhaps the reason is that get_active_pane_or_overlay returns the pane associated with the search overlay rather than the overlay itself, so the search overlay cannot receive the IME's composed input.

@wez

wez commented 1 month ago

@kenchou sort of, yes:

https://github.com/wez/wezterm/blob/f5e496ebc233187c076cbb34b3cd0f0c50290f51/wezterm-gui/src/overlay/copy.rs#L1102-L1104

it delegates writing the composed bytes to the pane behind the overlay.

To make processing of Composed events work, the writer method would need to return a proxy object that implements Write, and the write method of that object would need to perform the equivalent of:

https://github.com/wez/wezterm/blob/f5e496ebc233187c076cbb34b3cd0f0c50290f51/wezterm-gui/src/overlay/copy.rs#L1144