Mouse clic write stuff to terminal after being disconnected from remote #19504

Closed
opened 2026-01-31 06:45:21 +00:00 by claunia · 4 comments
Owner

Originally created by @4wk- on GitHub (Mar 7, 2023).

Windows Terminal version

1.16.10261.0

Windows build number

10.0.19045.2604

Other Software

No response

Steps to reproduce

  • Yesterday night, I had a multi windows setup on Windows Terminal, all running the Debian profile, and most of them were connected to a few remote Linux server using SSH.
  • On two windows, I used htop command to see live usage of server hardware (CPU, RAM, etc).
  • Then my computer went to sleep mode and lost internet connection.
  • On all the windows console connected to the remote server, I've got the usual message when getting disconnected client_loop: send disconnect: Broken pipe (I usually do a clear, and move on, but not this time)
  • Only on the 2 windows that were displaying the htop command I have an issue

Expected Behavior

I expect to get a full working console terminal on only windows.

Actual Behavior

But this time, only on the 2 windows that were displaying htop commands, I have a strange behavour of Windows Terminal:
=> Whenever I use my left click or right click on those windows, Windows beep and write to the console some stuff that appear to be the position of my mouse (because it changes whenever I move it then click).
For instance: X4#X4 or r2#r2 etc. Right click write the same kind of stuff but prefixed with ".

I ran exec bash --login to see if it was an issue with my Debian profile, but the issue with mouse click persists.
I didn't find a way to "restart" only those two windows of Windows Terminal to fix them.

Originally created by @4wk- on GitHub (Mar 7, 2023). ### Windows Terminal version 1.16.10261.0 ### Windows build number 10.0.19045.2604 ### Other Software _No response_ ### Steps to reproduce - Yesterday night, I had a multi windows setup on Windows Terminal, all running the Debian profile, and most of them were connected to a few remote Linux server using SSH. - On two windows, I used `htop` command to see live usage of server hardware (CPU, RAM, etc). - Then my computer went to sleep mode and lost internet connection. - On all the windows console connected to the remote server, I've got the usual message when getting disconnected `client_loop: send disconnect: Broken pipe` (I usually do a `clear`, and move on, but not this time) - Only on the 2 windows that were displaying the `htop` command I have an issue ### Expected Behavior I expect to get a full working console terminal on only windows. ### Actual Behavior But this time, only on the 2 windows that were displaying `htop` commands, I have a strange behavour of Windows Terminal: => Whenever I use my left click or right click on those windows, Windows beep and **write to the console some stuff that appear to be the position of my mouse** (because it changes whenever I move it then click). For instance: `X4#X4` or `r2#r2` etc. Right click write the same kind of stuff but prefixed with `"`. I ran `exec bash --login` to see if it was an issue with my Debian profile, but the issue with mouse click persists. I didn't find a way to "restart" only those two windows of Windows Terminal to fix them.
claunia added the Issue-QuestionNeeds-Tag-FixResolution-Answered labels 2026-01-31 06:45:22 +00:00
Author
Owner

@4wk- commented on GitHub (Mar 7, 2023):

Here is a screenshot.

  • in red: the previous display of htop command (OK). When getting disconnected, this is a normal behavour, the last stuff displayed stay on screen, but the prompt climb all the way to the top left.
  • in purple: the actual message from getting disconnected (OK)
  • in blue: all my left click and some right click, writing strange stuff to my console (KO)

windowsTerminalIssue

As stated before, I'm using Windows Terminal with a 6 split console, and this issue appear on only 2 of them.
Thank you for you help, and please let me know if you need more information or if I should test stuff.
I've search the opened issues but didn't find something similar (but to be honest, searching for "cursor" or "mouse click" etc is a very broad subject)

@4wk- commented on GitHub (Mar 7, 2023): Here is a screenshot. - in red: the previous display of `htop` command (OK). When getting disconnected, this is a normal behavour, the last stuff displayed stay on screen, but the prompt climb all the way to the top left. - in purple: the actual message from getting disconnected (OK) - in blue: all my left click and some right click, writing strange stuff to my console (KO) ![windowsTerminalIssue](https://user-images.githubusercontent.com/1439550/223365024-5732f696-e069-40eb-8e10-05bbf72e63e1.png) As stated before, I'm using Windows Terminal with a 6 split console, and this issue appear on only 2 of them. Thank you for you help, and please let me know if you need more information or if I should test stuff. I've search the opened issues but didn't find something similar (but to be honest, searching for "cursor" or "mouse click" etc is a very broad subject)
Author
Owner

@zadjii-msft commented on GitHub (Mar 7, 2023):

Basically, what happened here is that when your opened htop on the remote machine, it requested something called "mouse mode" from the Terminal. This causes mouse input to be sent as a string of characters like what you're seeing (but usually htop just reads them and never prints them to the screen). However, because ssh exited unexpectedly, htop never had a chance to cleanly exit mouse mode and return the Terminal to the normal state.

I believe a reset would fix this. If not, I can try and conjure up something more elaborate to manually reset each of the mouse modes.

See also: #6909, #6941

@zadjii-msft commented on GitHub (Mar 7, 2023): Basically, what happened here is that when your opened `htop` on the remote machine, it requested something called "mouse mode" from the Terminal. This causes mouse input to be sent as a string of characters like what you're seeing (but usually `htop` just reads them and never prints them to the screen). However, because `ssh` exited unexpectedly, `htop` never had a chance to cleanly exit mouse mode and return the Terminal to the normal state. I believe a `reset` would fix this. If not, I can try and conjure up something more elaborate to manually reset each of the mouse modes. See also: #6909, #6941
Author
Owner

@4wk- commented on GitHub (Mar 7, 2023):

@zadjii-msft Thanks for your quick reply, and explaining what is truely going on! That make sense. reset command indeed fixed the issue, so that's perfect. Sorry, I should have think of reset myself.
Thanks again! You can close this issue.

@4wk- commented on GitHub (Mar 7, 2023): @zadjii-msft Thanks for your quick reply, and explaining what is truely going on! That make sense. `reset` command indeed fixed the issue, so that's perfect. Sorry, I should have think of `reset` myself. Thanks again! You can close this issue.
Author
Owner

@DHowett commented on GitHub (Mar 7, 2023):

Thanks for following up!

@DHowett commented on GitHub (Mar 7, 2023): Thanks for following up!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19504