Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
john-persson-polestar opened this issue Oct 17, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@john-persson-polestar
Copy link

john-persson-polestar commented Oct 17, 2024

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
@john-persson-polestar john-persson-polestar added the bug Something isn't working label Oct 17, 2024
@tlvenn
Copy link

tlvenn commented Oct 23, 2024

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

@abhinavnatarajan
Copy link

I can confirm the same behaviour on PopOS 22.04 with Wezterm 20240203-110809-5046fc22 and tmux 3.5a. However, the strange thing is that these escape sequences are only produced on neovim 0.10.1, and not in other programs (pasting in vim proceeds without issue). The issue disappears when:

  1. I use Gnome terminal, or;
  2. I don't use tmux, or;
  3. I paste into vim instead of neovim, or;
  4. I have set -s extended-keys off in my tmux.conf. It does not matter whether I have set -as ',xterm*:extkeys' in tmux.conf or not.

@john-persson-polestar
Copy link
Author

john-persson-polestar commented Nov 11, 2024

@abhinavnatarajan , interesting observation. I thought for sure I was getting the same behaviour when pasting in my shell (zsh), but now I'm only able to reproduce it in NeoVim. I'm on version 0.10.1 as well.

@chenxin-yan
Copy link

I am experiencing the same issue. When I paste from the clipboard outside of tmux using cmd+v in WezTerm, it works fine, but it does not work inside a tmux session.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants