wez / wezterm

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

Pasting issues in WezTerm with tmux on macOS Sequoia when using extended key settings #6291

Open john-persson-polestar opened 1 week ago

john-persson-polestar commented 1 week ago

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

macOS

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

Yabai

WezTerm version

I get: "wezterm not found" when running this command

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

I initially set out to configure tmux and WezTerm to accept the key combination "Ctrl+Enter". To achieve this, I added the following settings to my tmux config:

set -g default-terminal "xterm-256color"
set -g extended-keys on
set -as terminal-features 'xterm*:extkeys'

While these settings successfully enabled Ctrl+Enter functionality, they introduced an unexpected side effect: pasting text now results in abnormal behavior. When pasting, escape sequences are inserted into the content, particularly replacing return characters. For example, pasting a simple enum from the clipboard results in this output:

const enum PageComponent {[27;5;106~  FORM = "form",[27;5;106~  SUCCESS = "success",[27;5;106~  ERROR = "error",[27;5;106~}[27;5;106~

This issue occurs only in WezTerm when used with tmux and the extended key settings. The same tmux configuration works correctly in iTerm2, suggesting the problem is specific to WezTerm's interaction with tmux when these extended key settings are enabled.

I'm able to reproduce this issue with the default WezTerm configuration (i..e no configuration of my own), and have also tried multiple options but failed to find anything that works.

To Reproduce

  1. Start WezTerm
  2. Launch tmux using the configuration provided above
  3. Copy a multi-line text snippet (e.g., code block) to your clipboard
  4. Paste the text into the tmux session in WezTerm (using Cmd+V or right-click paste)
  5. Observe that the pasted text includes unexpected escape sequences, particularly replacing return characters

Configuration

Default configuration, i.e. nothing custom.

Expected Behavior

Pasting without escape sequence with the following tmux configuration :

set -g default-terminal "xterm-256color"
set -g extended-keys on
set -as terminal-features 'xterm*:extkeys'

Logs

No response

Anything else?

I'm on the latest nightly build.

Running

wezterm -V

Gives me the message:

wezterm not found
tlvenn commented 2 days ago

I can confirm the same thing happen on Sonoma and with NixOs