Paste not work correctly when running vim on remote machine #8994

Closed
opened 2026-01-31 01:43:15 +00:00 by claunia · 9 comments
Owner

Originally created by @BusyJay on GitHub (Jun 12, 2020).

Originally assigned to: @DHowett on GitHub.

Environment

Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd]
Windows Terminal version (if applicable):

Any other software?

Windows version: 10.0.18363.0
Windows Terminal version: 1.0.1401.0
Ssh client version: OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
Powershell Core version: 7.0.1

Steps to reproduce

  1. Ssh to a remote machine
  2. Copy some data
  3. Start an editor in the remote machine using vim and enter insert mode
  4. Right click to paste the data copied at step 2.

Expected behavior

Data copied at step 2 shows up in terminal.

Actual behavior

Nothing shows up.

Just using powershell core without Windows Terminal work as expected. Using Windows Terminal but using nano instead of vim, it also works.

Originally created by @BusyJay on GitHub (Jun 12, 2020). Originally assigned to: @DHowett on GitHub. <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd] Windows Terminal version (if applicable): Any other software? ``` Windows version: 10.0.18363.0 Windows Terminal version: 1.0.1401.0 Ssh client version: OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5 Powershell Core version: 7.0.1 # Steps to reproduce 1. Ssh to a remote machine 2. Copy some data 3. Start an editor in the remote machine using `vim` and enter insert mode 4. Right click to paste the data copied at step 2. # Expected behavior Data copied at step 2 shows up in terminal. <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> # Actual behavior <!-- What's actually happening? --> Nothing shows up. Just using powershell core without Windows Terminal work as expected. Using Windows Terminal but using nano instead of vim, it also works.
Author
Owner

@WSLUser commented on GitHub (Jun 12, 2020):

OpenSSH_for_Windows_7.7p1

Can you bump to the 8.1 release?

@WSLUser commented on GitHub (Jun 12, 2020): > OpenSSH_for_Windows_7.7p1 Can you bump to the 8.1 release?
Author
Owner

@BusyJay commented on GitHub (Jun 12, 2020):

Why? If OpenSSH is the one to blame, then why it works on powershell core without Windows Terminal?

@BusyJay commented on GitHub (Jun 12, 2020): Why? If OpenSSH is the one to blame, then why it works on powershell core without Windows Terminal?
Author
Owner

@DHowett commented on GitHub (Jun 12, 2020):

Hey, when vim is running in SSH can you still select text?

If not, can you try to Shift+Right Click to paste?

@DHowett commented on GitHub (Jun 12, 2020): Hey, when vim is running in SSH can you still select text? **If not**, can you try to _<kbd>Shift+Right Click</kbd>_ to paste?
Author
Owner

@BusyJay commented on GitHub (Jun 12, 2020):

when vim is running in SSH can you still select text?

No, I can't select text.

can you try to Shift+Right Click to paste?

It works.

And just confirm it seems be related to the remote shell. The issue only happens when remote shell is fish shell.

@BusyJay commented on GitHub (Jun 12, 2020): > when vim is running in SSH can you still select text? No, I can't select text. > can you try to Shift+Right Click to paste? It works. And just confirm it seems be related to the remote shell. The issue only happens when remote shell is fish shell.
Author
Owner

@DHowett commented on GitHub (Jun 12, 2020):

So, this is a weird interaction between the remote app, ssh and terminal.

  • Vim and a couple other applications request mouse input ("Terminal, send me info about the mouse!")
  • SSH passes this request through
  • Terminal receives it, and starts to direct mouse input into Vim

This works great in WSL and with OpenSSH 8.
When it's working, left click/right click are supposed to go directly to Vim so it can handle them.

When mouse mode is turned off, right-click goes to the Terminal which turns it into a paste.

What happens with SSH 7.7, however is:

  • Terminal sends mouse data to SSH (as requested)
  • SSH intercepts it and ignores it
  • Vim never receives it.
@DHowett commented on GitHub (Jun 12, 2020): So, this is a weird interaction between the remote app, ssh and terminal. * Vim and a couple other applications request mouse input ("Terminal, send me info about the mouse!") * SSH passes this request through * Terminal receives it, and starts to direct mouse input into Vim This works great in WSL and with OpenSSH 8. When it's working, left click/right click are supposed to go directly to Vim so it can handle them. When mouse mode is turned off, right-click goes to the Terminal which turns it into a paste. What happens with SSH 7.7, however is: * Terminal sends mouse data to SSH (as requested) * SSH **intercepts it and ignores it** * Vim never receives it.
Author
Owner

@BusyJay commented on GitHub (Jun 13, 2020):

So mouse mode is disabled when shift is hold?

@BusyJay commented on GitHub (Jun 13, 2020): So mouse mode is disabled when shift is hold?
Author
Owner

@DHowett commented on GitHub (Jun 13, 2020):

Correct :)

We used to have a workaround that made it so SSH couldn’t mess up the terminal if it wasn’t going to handle mouse mode. I sent out a pull request that brings that workaround back. It should fix the symptom, but it will not make mouse mode work in SSH. 😄

@DHowett commented on GitHub (Jun 13, 2020): Correct :) We used to have a workaround that made it so SSH couldn’t mess up the terminal if it wasn’t going to handle mouse mode. I sent out a pull request that brings that workaround back. It should fix the symptom, but it will not make mouse mode work in SSH. 😄
Author
Owner

@ghost commented on GitHub (Jun 18, 2020):

:tada:This issue was addressed in #6485, which has now been successfully released as Windows Terminal Preview v1.1.1671.0.🎉

Handy links:

@ghost commented on GitHub (Jun 18, 2020): :tada:This issue was addressed in #6485, which has now been successfully released as `Windows Terminal Preview v1.1.1671.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.1.1671.0) * [Store Download](https://www.microsoft.com/store/apps/9n0dx20hk701?cid=storebadge&ocid=badge)
Author
Owner

@ghost commented on GitHub (Jun 30, 2020):

:tada:This issue was addressed in #6485, which has now been successfully released as Windows Terminal v1.0.1811.0.🎉

Handy links:

@ghost commented on GitHub (Jun 30, 2020): :tada:This issue was addressed in #6485, which has now been successfully released as `Windows Terminal v1.0.1811.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.0.1811.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#8994