[PR #15062] fix: WpfTerminalControl allow Connection set to null #30387

Open
opened 2026-01-31 09:40:31 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/15062

State: closed
Merged: Yes


Hides the cursor when null, shows it when not.
Clear the screen any time the connection is changed.

Summary of the Pull Request

Prevents the WPF Control from crashing when set back to null, clears the console and hides the mouse as well.

References and Relevant Issues

#15061

Detailed Description of the Pull Request / Additional comments

It say 3 ansi commands as well now:

  1. When the Connection is set to null the cursor is hidden (reflects what the default state is)
  2. When the Connection is set to a value and it was null before we show the cursor (not a breaking change as requires it to have been null which previously would cause a crash, except for for set)
  3. When the Connection is changed the screen is cleared. A breaking change officially although not sure if there are use cases where this behavior is not desired. For added safety we could make sure we are not being set to the same value we currently are.

None of the ansi commands are needed, users could do it all themselves as well, the behavior largely seemed natural though. I didn't see any ansi constants anywhere so they are just hard coded with comments, but not sure if there is an established better practice.

Closes #15061

**Original Pull Request:** https://github.com/microsoft/terminal/pull/15062 **State:** closed **Merged:** Yes --- Hides the cursor when null, shows it when not. Clear the screen any time the connection is changed. ## Summary of the Pull Request Prevents the WPF Control from crashing when set back to null, clears the console and hides the mouse as well. ## References and Relevant Issues #15061 ## Detailed Description of the Pull Request / Additional comments It say 3 ansi commands as well now: 1) When the Connection is set to null the cursor is hidden (reflects what the default state is) 2) When the Connection is set to a value and it was null before we show the cursor (not a breaking change as requires it to have been null which previously would cause a crash, except for for set) 3) When the Connection is changed the screen is cleared. A breaking change officially although not sure if there are use cases where this behavior is not desired. For added safety we could make sure we are not being set to the same value we currently are. None of the ansi commands are needed, users could do it all themselves as well, the behavior largely seemed natural though. I didn't see any ansi constants anywhere so they are just hard coded with comments, but not sure if there is an established better practice. Closes #15061
claunia added the pull-request label 2026-01-31 09:40:31 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#30387