terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Continue SGR 5 blinking when Terminal is out of focus (but not minimized)

Open Nick2bad4u opened this issue 3 months ago • 3 comments

Windows Terminal version

Windows Terminal Preview Version: 1.24.2812.0

Windows build number

10.0.22631.0 Microsoft Windows NT 10.0.22631.0

Other Software

N/A

Steps to reproduce

Link to screencast: https://i.gyazo.com/690eb0d26d19c1d1f46f831558c3acaa.mp4

https://github.com/user-attachments/assets/19583495-ffbe-4609-8393-d9f0b8dbba55

Steps to Reproduce

  1. Open Windows Terminal.
  2. Display a large ANSI-formatted output (for example, using Vim, or a CLI application with lots of colors). (If you want the exact script I'm using: ansi-star-wars-ndh-r2d2.ps1
  3. Unfocus/minimize the Terminal window.
  4. Observe color values shifting slightly between states until focus is restored. I've noticed it mainly happens with grey colors.

I can provide any other data upon request.

Expected Behavior

ANSI display colors should remain consistent, regardless of window focus (unless using the unfocused theming in wt preview obviously)

Actual Behavior

Colors shift back and forth while the window is not focused. This results in visual flicker or inconsistency for ANSI color output until the window regains focus.

Nick2bad4u avatar Nov 05 '25 00:11 Nick2bad4u

So! This image uses SGR 5 ("Blink") which dims and brightens the foreground color every second or so--every other cursor blink, actually.

Terminal suspends the blinking cursor when it loses focus, and so likewise it suspends the timer that blinks text with the SGR 5 blink rendition.

For now, that means the dim text will remain dim if it was dim when it lost focus, and remain bright if it was bright when it lost focus.

Perhaps we should keep SGR 5 blinking blinking when the window is out of focus?

DHowett avatar Nov 05 '25 20:11 DHowett

(Also: I suspect your r2-d2 will look a lot better if you turn on builtinGlyphs. I know that it messes with the authorial intent of the font, but it eliminates the gaps between sections filled with the unicode block characters :P)

DHowett avatar Nov 05 '25 20:11 DHowett

So! This image uses SGR 5 ("Blink") which dims and brightens the foreground color every second or so--every other cursor blink, actually.

Terminal suspends the blinking cursor when it loses focus, and so likewise it suspends the timer that blinks text with the SGR 5 blink rendition.

For now, that means the dim text will remain dim if it was dim when it lost focus, and remain bright if it was bright when it lost focus.

Perhaps we should keep SGR 5 blinking blinking when the window is out of focus?

Wow I didn't even know that was a character you could use.

If that's the case I would say this is working as intended then.

Built in glyphs doesn't seem to make a difference when I enable it?

Are you getting a better picture with it on? I turned it off because it was causing some alignment issues I thought but that was a long time ago

I'll try turning it on when I'm back at my PC.

Edit: you're correct it does look better thanks for the tip..you can probably close this as it's working as intended and I just didnt realize there's a blink character 😭

Nick2bad4u avatar Nov 05 '25 22:11 Nick2bad4u