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

Mosh + WSL - cannot copy-and-paste #12638

Closed
kellytrinh opened this issue Mar 8, 2022 · 5 comments
Closed

Mosh + WSL - cannot copy-and-paste #12638

kellytrinh opened this issue Mar 8, 2022 · 5 comments
Labels
Issue-Question For questions or discussion Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. Resolution-Answered Related to questions that have been answered Tracking-External This bug isn't resolved, but it's following an external workitem.

Comments

@kellytrinh
Copy link

kellytrinh commented Mar 8, 2022

Windows Terminal version

1.11.3471.0

Windows build number

Version 10.0.19043.1526

Other Software

Ubuntu 18.04 running under WSL
mosh 1.3.2
tmux 2.6

Steps to reproduce

  1. within setting.json have tab setup as "wsl.exe mosh hostname"
  2. host has tmux with mouse support via tmux.conf "set -g mouse on"
  3. open session with the host using that tab
  4. try to copy text by selecting text

Expected Behavior

Expected that the text is copied and can paste as usual from windows clipboard

Actual Behavior

The clipboaard is untouched. Previous contents still there.

Note: Isolated to some interaction between mosh when run from 'settings.json' in windows terminal.

For the same setup:

  • If "settings.json" has "wsl.exe ssh hostname", then copy-and-paste works fine.
  • If tab opened via ssh and within that ssh session do "mosh hostname", the copy-and-paste also works fine.
@kellytrinh kellytrinh added the Issue-Bug It either shouldn't be doing this or needs an investigation. label Mar 8, 2022
@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Mar 8, 2022
@zadjii-msft
Copy link
Member

When you enable set -g mouse on in tmux, you're entering "mouse mode". That gives tmux full control over the mouse events, including clicking and dragging. So any selection you might see on the screen isn't actually a selection created by the Terminal, but rather one owned by tmux itself. If you want to escape the tmux mouse handling, you can hold shift while dragging, which will make a normal Terminal selection. That, you should be able to still copy as expected.

Does that work as expected for you?

@zadjii-msft zadjii-msft added Issue-Question For questions or discussion Resolution-Answered Related to questions that have been answered Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Issue-Bug It either shouldn't be doing this or needs an investigation. labels Mar 8, 2022
@kellytrinh
Copy link
Author

The hold-shift workaround doesn't respect vertical panes in tmux (the selection doesn't wrap around the pane borders) so is not helpful unfortunately.

I do see that tmux is capturing the mouse events. When using ssh, when I am selecting text, tmux will highlight the selection, wrapping around the vertical pane borders correctly, and upon release of mouse button the selection is copied correctly. But when switch over to mosh then it doesn't work anymore - during the hold-mouse-button phase tmux is highlighting the selection as before; but upon releasing mouse button - the selection isn't copied to clipboard.

Perhaps issue is something around how Windows Terminal is passing the mouse-button-release event to ssh vs mosh?

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Mar 8, 2022
@zadjii-msft
Copy link
Member

Hey sorry, haven't had the chance to dig in too much further. The triage queue is deep, sorry this got lost. My theory is that this has to do with OSC52, "MANIPULATE SELECTION DATA", or "copy to clipboard". (see implementation in #5823).

I wonder if mosh is eating the OSC52's. That would prevent the Terminal from ever being told what the new clipboard contents should be.

@zadjii-msft
Copy link
Member

zadjii-msft commented Jul 6, 2022

https://andrewmzhang.com/blog/2020/osc-52-patch-for-vte-0425/
https://gist.github.com/yudai/95b20e3da66df1b066531997f982b57b
mobile-shell/mosh#1054

Yea this might be a mosh issue. Can you try changing your tmux conf like in the above posts, to see if that remedies this/?

@zadjii-msft zadjii-msft added Tracking-External This bug isn't resolved, but it's following an external workitem. and removed Needs-Attention The core contributors need to come back around and look at this ASAP. labels Jul 6, 2022
@ghost ghost added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. labels Jul 6, 2022
@ghost
Copy link

ghost commented Jul 10, 2022

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost ghost closed this as completed Jul 13, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Question For questions or discussion Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. Resolution-Answered Related to questions that have been answered Tracking-External This bug isn't resolved, but it's following an external workitem.
Projects
None yet
Development

No branches or pull requests

2 participants