Terminal window closes on right-click, when connection is closed and waiting for keypress #20343

Closed
opened 2026-01-31 07:10:54 +00:00 by claunia · 3 comments
Owner

Originally created by @zadjii-msft on GitHub (Aug 7, 2023).

Originally assigned to: @zadjii-msft on GitHub.

from MSFT:45731977

When you run an application from Visual Studio, and use Windows Terminal, at the end of the application run it will display "press any key to close the window". This is as expected. However, it doesn't only close on keyboard input, but also when you right-click the Terminal window. This is NOT desirable, since right click is also used for copying text.
It should ONLY close on keyboard input.

I noticed that this only happens when you have a small amount of text in the clipboard that doesn't trigger any messagebox (ie. warnings about pasting a lot of text).

I guess what happens is that the right click actually pastes text into the console, and this is then seen as keyboard input and closes the terminal.

I have lost a lot of time running long apps that print debug information to the console by accidentally right clicking INTO the console window, when I wanted to right click on its tab to select "Export Text". It would be very useful, if pasting text was disabled in case the terminal would close on input.

Originally created by @zadjii-msft on GitHub (Aug 7, 2023). Originally assigned to: @zadjii-msft on GitHub. _from MSFT:45731977_ > When you run an application from Visual Studio, and use Windows Terminal, at the end of the application run it will display "press any key to close the window". This is as expected. However, it doesn't only close on keyboard input, but also when you right-click the Terminal window. This is NOT desirable, since right click is also used for copying text. It should ONLY close on keyboard input. > I noticed that this only happens when you have a small amount of text in the clipboard that doesn't trigger any messagebox (ie. warnings about pasting a lot of text). > > I guess what happens is that the right click actually pastes text into the console, and this is then seen as keyboard input and closes the terminal. > > I have lost a lot of time running long apps that print debug information to the console by accidentally right clicking INTO the console window, when I wanted to right click on its tab to select "Export Text". It would be very useful, if pasting text was disabled in case the terminal would close on input.
Author
Owner

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

I coulda swore that we didn't paste on a right-click if the right click was causing the window to be focused. Maybe that got lost? Or I'm mistaken?

@zadjii-msft commented on GitHub (Aug 7, 2023): I coulda swore that we _didn't_ paste on a right-click if the right click was causing the window to be focused. Maybe that got lost? Or I'm mistaken?
Author
Owner

@zadjii-msft commented on GitHub (Apr 1, 2024):

Hmm, even if you go back to 8910a16fd0 (diff-c10bb023995e88dac6c1d786129284c454c2df739ea547ce462129dc86dc2697), I suspect this was broken. (that's 3 years old now).

Even in that one, if the TermControl was unfocused, we'd focus it, but then we'd power along and eventually just copy anyways. Weird. Whatever. Easy enough to fix.

@zadjii-msft commented on GitHub (Apr 1, 2024): Hmm, even if you go back to https://github.com/microsoft/terminal/commit/8910a16fd0d0ebf0feaa7b182a5f812a0b28f2d4#diff-c10bb023995e88dac6c1d786129284c454c2df739ea547ce462129dc86dc2697, I suspect this was broken. (that's 3 years old now). Even in that one, if the TermControl was unfocused, we'd focus it, but then we'd power along and eventually just copy anyways. Weird. Whatever. Easy enough to fix.
Author
Owner

@zadjii-msft commented on GitHub (Apr 2, 2024):

Meh, we decided that this is perfectly reasonable behavior as-is.

@zadjii-msft commented on GitHub (Apr 2, 2024): Meh, we decided that this is perfectly reasonable behavior as-is.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20343