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

linux, xsel: Primary paste in the tmux window doesn't work immediately #136

Open
tompreston opened this issue Jan 23, 2020 · 3 comments
Open

Comments

@tompreston
Copy link

tompreston commented Jan 23, 2020

With set -g mouse on, when I highlight text tmux-yank copies it to the primary buffer using xsel. When I immediately try to paste this text in any pane (using shift+middle-click) in the same tmux instance it fails to paste. xsel -p prints the previously highlighted text - so the copy part is working, just paste isn't.

If I middle-click into any other window, the paste works. And from then on, the paste also works in tmux. This suggests to me that there is something blocking the shift-middle-click paste in tmux, until the terminal window loses focus. Copy/primary-paste continues to work for a short time after this, then it happens again (after ~2 mins).

This happens in fullscreen or windowed mode and seems to also apply to the clipboard buffer (when text is copied by pressing "y" instead of mouse-up).

I'm aware I can just bypass tmux by holding down Alt, but this doesn't work with panes as it selects a whole line across the display. I'd like to copy multi-line per pane.

I'm not sure how to debug the middle-click paste event in tmux. What debug options can I turn on to print more information about this? Thanks

tmux 2.9a, Fedora 32, gnome-terminal 3.34.2

@tompreston
Copy link
Author

I can reproduce this faster with the following sequence:

  1. Shift-highlight, to bypass (un-focus?) tmux and copy text to primary buffer
  2. Shift-middle-click, to paste primary buffer into tmux
  3. Normal "mouse on" highlight, to tmux-yank copy text to primary buffer (works)
  4. Shift-middle-click, to paste primary buffer into tmux (does not work)

I can paste the primary buffer selected in 3 into another terminal. After this the paste works again in the first tmux/gnome-terminal instance.

@tompreston
Copy link
Author

tompreston commented Jan 27, 2020

Another quick workaround is to highlight text and mouse-up (copying to primary clipboard), then press the super-key (Windows key) twice. In Gnome 3, this enters and leaves the "Activities" overview (I think that's what it's called) - re-focusing the terminal and letting me paste with middle-click.

I think the next steps to debug this are:

  • Reproducing on another machine/os (maybe it's just me?)
  • Reproduce with upstream tmux
  • Add debug to upstream tmux mouse-up and middle-click events
  • Add debug to "paste" action - if that's even a thing.

Hopefully someone with more knowledge of tmux can point me in the right direction.

@sisrfeng
Copy link

sisrfeng commented Dec 8, 2021

I use mobaxterm on win10 locally ,ssh to remote ubuntu 20.04, run in tmux.
Yank is quite slow too.
Look forward to improvement.
Thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants