microsoft / microsoft/terminal
Using an Unfocused Appearance resets any runtime palette and cursor changes
- Dominant language
- C++
- Stars
- 105k
- Forks
- 9.6k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 29
Description
### Windows Terminal version
1.12.3472.0
### Windows build number
10.0.19041.1348
### Other Software
_No response_
### Steps to reproduce
1. Open the Settings in Windows Terminal and go to the _Profiles Defaults_ section.
2. On the _Appearance_ tab, enable the _Unfocused Appearance_ option (you don't need to change any of the properties though).
3. Open a WSL bash shell.
4. Change the default background palette to red using an `OSC 11` sequence:
`printf "\e]11;rgb:44/00/00\e\\"`
5. Change the cursor shape to a filled box (something other than your default) with a `DECSCUSR` sequence:
`printf "\e[1 q"`
6. Switch focus to another application and then switch back again.
### Expected Behavior
When the focus returns, I'd expect the background color to be red again, and the cursor to be a filled box again.
### Actual Behavior
The background color changes back to the original color scheme, and the cursor returns to the original value in the settings.
I'm not sure there is a good way to fix this though. Perhaps we should be saving the active settings when the app loses focus, and then restoring them when it gains focus again, rather than resetting everything? That doesn't handle all edge case, but it's probably better than nothing.
Otherwise I suppose we could say that runtime changes to these settings aren't expected to work if you've configured an _Unfocused Appearance_. But if we're going to take that approach, then I think we should really be disabling those sequences completely. Having them appear to work, but then get "randomly" reset just seems like a bug.
Contributor guide
Research direction
Reproduce the issue using the listed Unfocused Appearance, OSC 11, and DECSCUSR steps, then trace the focus-loss and focus-gain handling for appearance restoration. Determine whether runtime palette and cursor changes should be preserved or the sequences disabled when Unfocused Appearance is enabled; done means the behavior is consistent and covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- cli, desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100