Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SGR Blinking doesn't work in conjunction with Faint #15676

Open
ClaireCJS opened this issue Jul 7, 2023 · 14 comments
Open

SGR Blinking doesn't work in conjunction with Faint #15676

ClaireCJS opened this issue Jul 7, 2023 · 14 comments
Labels
Area-VT Virtual Terminal sequence support Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) Product-Terminal The new Windows Terminal.
Milestone

Comments

@ClaireCJS
Copy link

Windows Terminal version

1.17.11461.0

Windows build number

10.0.19045.3086

Other Software

No response

Steps to reproduce

use ansi codes to render blinking faint text

Expected Behavior

text blinks, but is fainter than non-faint blinking text

Actual Behavior

text doesn't blink at all

see video

windows.terminal.blinking.not.for.faint.mp4
@ClaireCJS ClaireCJS added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Jul 7, 2023
@ClaireCJS
Copy link
Author

For reference, the environment variables are set via my own set-colors.bat:

Other than the "%@char[27]" TCC-specific syntax I use to set the escape character, if you fix that one part, this should work for any command line, and is quite convenient for echoing messages using the advanced ANSI styling that Windows Terminal finally brings to the table so eloquently.

But yea, I'm in the ditches testing, and found this one odd behavior :)

REM colors for ANSI
        rem refactor annoying left bracket
            set ESCAPE=%@CHAR[27]
            set ANSI_ESCAPE=%@CHAR[27][
            set ANSI_RESET=%ANSI_ESCAPE%0m
        rem Foreground Colors
            set ANSI_BLACK=%ANSI_ESCAPE%30m
            set ANSI_RED=%ANSI_ESCAPE%31m
            set ANSI_GREEN=%ANSI_ESCAPE%32m
            set ANSI_YELLOW=%ANSI_ESCAPE%33m
            set ANSI_BLUE=%ANSI_ESCAPE%34m
            set ANSI_MAGENTA=%ANSI_ESCAPE%35m
            set ANSI_CYAN=%ANSI_ESCAPE%36m
            set ANSI_WHITE=%ANSI_ESCAPE%37m
            set ANSI_GRAY=%ANSI_ESCAPE%90m
            set ANSI_GREY=%ANSI_ESCAPE%90m
            set ANSI_BRIGHT_RED=%ANSI_ESCAPE%91m
            set ANSI_BRIGHT_GREEN=%ANSI_ESCAPE%92m
            set ANSI_BRIGHT_YELLOW=%ANSI_ESCAPE%93m
            set ANSI_BRIGHT_BLUE=%ANSI_ESCAPE%94m
            set ANSI_BRIGHT_MAGENTA=%ANSI_ESCAPE%95m
            set ANSI_BRIGHT_CYAN=%ANSI_ESCAPE%96m
            set ANSI_BRIGHT_WHITE=%ANSI_ESCAPE%97m
        rem Background Colors
            set ANSI_BACKGROUND_BLACK=%ANSI_ESCAPE%40m
            set ANSI_BACKGROUND_RED=%ANSI_ESCAPE%41m
            set ANSI_BACKGROUND_GREEN=%ANSI_ESCAPE%42m
            set ANSI_BACKGROUND_YELLOW=%ANSI_ESCAPE%43m
            set ANSI_BACKGROUND_BLUE=%ANSI_ESCAPE%44m
            set ANSI_BACKGROUND_MAGENTA=%ANSI_ESCAPE%45m
            set ANSI_BACKGROUND_CYAN=%ANSI_ESCAPE%46m
            set ANSI_BACKGROUND_WHITE=%ANSI_ESCAPE%47m
            set ANSI_BACKGROUND_GREY=%ANSI_ESCAPE%100m
            set ANSI_BACKGROUND_GRAY=%ANSI_ESCAPE%100m
            set ANSI_BACKGROUND_BRIGHT_RED=%ANSI_ESCAPE%101m
            set ANSI_BACKGROUND_BRIGHT_GREEN=%ANSI_ESCAPE%102m
            set ANSI_BACKGROUND_BRIGHT_YELLOW=%ANSI_ESCAPE%103m
            set ANSI_BACKGROUND_BRIGHT_BLUE=%ANSI_ESCAPE%104m
            set ANSI_BACKGROUND_BRIGHT_MAGENTA=%ANSI_ESCAPE%105m
            set ANSI_BACKGROUND_BRIGHT_CYAN=%ANSI_ESCAPE%106m
            set ANSI_BACKGROUND_BRIGHT_WHITE=%ANSI_ESCAPE%107m


REM As of Windows Terminal we can now actually display italic characters
            REM 0m=reset, 1m=bold, 2m=faint, 3m=italic, 4m=underline, 5m=blink slow, 6m=blink fast, 7m=reverse, 8m=conceal, 9m=strikethrough
            set ANSI_BOLD=%ANSI_ESCAPE%1m
            set ANSI_BOLD_ON=%ANSI_BOLD%
            set ANSI_BOLD_OFF=%ANSI_ESCAPE%22m
            set      BOLD_ON=%ANSI_BOLD_ON%
            set      BOLD_OFF=%ANSI_BOLD_OFF%
            set      BOLD=%BOLD_ON%

            set ANSI_FAINT=%ANSI_ESCAPE%2m
            set ANSI_FAINT_ON=%ANSI_FAINT%
            set ANSI_FAINT_OFF=%ANSI_ESCAPE%22m
            set      FAINT_ON=%ANSI_FAINT_ON%
            set      FAINT_OFF=%ANSI_FAINT_OFF%
            set      FAINT=%FAINT_ON%

            set ANSI_ITALICS=%ANSI_ESCAPE%3m
            set ANSI_ITALICS_ON=%ANSI_ITALICS%
            set ANSI_ITALICS_OFF=%ANSI_ESCAPE%23m
            set      ITALICS_ON=%ANSI_ITALICS_ON%
            set      ITALICS_OFF=%ANSI_ITALICS_OFF%
            set      ITALICS=%ITALICS_ON%

            set ANSI_UNDERLINE=%ANSI_ESCAPE%4m
            set ANSI_UNDERLINE_ON=%ANSI_UNDERLINE%
            set ANSI_UNDERLINE_OFF=%ANSI_ESCAPE%24m
            set      UNDERLINE_ON=%ANSI_UNDERLINE_ON%
            set      UNDERLINE_OFF=%ANSI_UNDERLINE_OFF%
            set      UNDERLINE=%UNDERLINE_ON%

            set ANSI_OVERLINE=%ANSI_ESCAPE%53m
            set ANSI_OVERLINE_ON=%ANSI_OVERLINE%
            set ANSI_OVERLINE_OFF=%ANSI_ESCAPE%55m
            set      OVERLINE_ON=%ANSI_OVERLINE_ON%
            set      OVERLINE_OFF=%ANSI_OVERLINE_OFF%
            set      OVERLINE=%OVERLINE_ON%

            set ANSI_DOUBLE_UNDERLINE=%ANSI_ESCAPE%21m
            set ANSI_DOUBLE_UNDERLINE_ON=%ANSI_DOUBLE_UNDERLINE%
            set ANSI_DOUBLE_UNDERLINE_OFF=%ANSI_ESCAPE%24m
            set      DOUBLE_UNDERLINE_ON=%ANSI_DOUBLE_UNDERLINE_ON%
            set      DOUBLE_UNDERLINE_OFF=%ANSI_DOUBLE_UNDERLINE_OFF%
            set      DOUBLE_UNDERLINE=%DOUBLE_UNDERLINE_ON%

                set ANSI_UNDERLINE_DOUBLE=%ANSI_DOUBLE_UNDERLINE%
                set ANSI_UNDERLINE_DOUBLE_ON=%ANSI_DOUBLE_UNDERLINE_ON%
                set ANSI_UNDERLINE_DOUBLE_OFF=%ANSI_DOUBLE_UNDERLINE_OFF%
                set      UNDERLINE_DOUBLE_ON=%DOUBLE_UNDERLINE_ON%
                set      UNDERLINE_DOUBLE_OFF=%DOUBLE_UNDERLINE_OFF%
                set      UNDERLINE_DOUBLE=%DOUBLE_UNDERLINE%


            set ANSI_BLINK_SLOW=%ANSI_ESCAPE%5m
            set ANSI_BLINK_SLOW_ON=%ANSI_BLINK_SLOW%
            set ANSI_BLINK_SLOW_OFF=%ANSI_ESCAPE%25m
            set      BLINK_SLOW_ON=%ANSI_BLINK_SLOW_ON%
            set      BLINK_SLOW_OFF=%ANSI_BLINK_SLOW_OFF%
            set      BLINK_SLOW=%BLINK_SLOW_ON%

            set ANSI_BLINK_FAST=%ANSI_ESCAPE%6m
            set ANSI_BLINK_FAST_ON=%ANSI_BLINK_FAST%
            set ANSI_BLINK_FAST_OFF=%ANSI_ESCAPE%25m
            set      BLINK_FAST_ON=%ANSI_BLINK_FAST_ON%
            set      BLINK_FAST_OFF=%ANSI_BLINK_FAST_OFF%
            set      BLINK_FAST=%BLINK_FAST_ON%

            set ANSI_BLINK=%ANSI_BLINK_FAST%
            set ANSI_BLINK_ON=%ANSI_BLINK_FAST_ON%
            set ANSI_BLINK_OFF=%ANSI_BLINK_FAST_OFF%
            set      BLINK_ON=%ANSI_BLINK_ON%
            set      BLINK_OFF=%ANSI_BLINK_OFF%
            set      BLINK=%BLINK_ON%

            set ANSI_REVERSE=%ANSI_ESCAPE%7m
            set ANSI_REVERSE_ON=%ANSI_REVERSE%
            set ANSI_REVERSE_OFF=%ANSI_ESCAPE%27m
            set      REVERSE_ON=%ANSI_REVERSE_ON%
            set      REVERSE_OFF=%ANSI_REVERSE_OFF%
            set      REVERSE=%REVERSE_ON%

            set ANSI_CONCEAL=%ANSI_ESCAPE%8m
            set ANSI_CONCEAL_ON=%ANSI_CONCEAL%
            set ANSI_CONCEAL_OFF=%ANSI_ESCAPE%28m
            set      CONCEAL_ON=%ANSI_CONCEAL_ON%
            set      CONCEAL_OFF=%ANSI_CONCEAL_OFF%
            set      CONCEAL=%CONCEAL_ON%

            set ANSI_STRIKETHROUGH=%ANSI_ESCAPE%9m
            set ANSI_STRIKETHROUGH_ON=%ANSI_STRIKETHROUGH%
            set ANSI_STRIKETHROUGH_OFF=%ANSI_ESCAPE%29m
            set      STRIKETHROUGH_ON=%ANSI_STRIKETHROUGH_ON%
            set      STRIKETHROUGH_OFF=%ANSI_STRIKETHROUGH_OFF%
            set      STRIKETHROUGH=%STRIKETHROUGH_ON%
                set OVERSTRIKE_ON=%STRIKETHROUGH_ON%
                set OVERSTRIKE_OFF=%STRIKETHROUGH_OFF%
                set OVERSTRIKE=%OVERSTRIKE_ON%


REM wow it even supports the vt100 2-line-tall text!
            set BIG_TEXT_LINE_1=%ESCAPE%#3
            set BIG_TEXT_LINE_2=%ESCAPE%#4
            set BIG_TOP=%BIG_TEXT_LINE_1%
            set BIG_TOP_ON=%BIG_TOP%
            set BIG_BOT=%BIG_TEXT_LINE_2%
            set BIG_BOT_ON=%BIG_BOT%
            set BIG_BOTTOM=%BIG_BOT%
            set BIG_BOTTOM_ON=%BIG_BOTTOM%
            REM this is a guess:
            set BIG_TEXT_END=%ESCAPE%#0
            set BIG_OFF=%BIG_TEXT_END%
            set BIG_TOP_OFF=%BIG_OFF%
            set BIG_BOT_OFF=%BIG_OFF%


REM test strings that demonstrate all this ANSI functionality
        set ANSI_TEST_STRING=concealed:'%CONCEAL%conceal%CONCEAL_off%' %ANSI_RED%R%ANSI_ORANGE%O%ANSI_YELLOW%Y%ANSI_GREEN%G%ANSI_CYAN%C%ANSI_BLUE%B%ANSI_MAGENTA%V%ANSI_WHITE% Hello, world. %BOLD%Bold!%BOLD_OFF% %FAINT%Faint%FAINT_OFF% %ITALICS%Italics%ITALIC_OFF% %UNDERLINE%underline%UNDERLINE_OFF% %OVERLINE%overline%OVERLINE_OFF% %DOUBLE_UNDERLINE%double_underline%DOUBLE_UNDERLINE_OFF% %REVERSE%reverse%REVERSE_OFF% %BLINK_SLOW%blink_slow%BLINK_SLOW_OFF% [non-blinking] %BLINK_FAST%blink_fast%BLINK_FAST_OFF% [non-blinking] %blink%blink_default%blink_off% [non-blinking] %STRIKETHROUGH%strikethrough%STRIKETHROUGH_OFF% 
        set ANSI_TEST_STRING_2=%BIG_TEXT_LINE_1%big% %ANSI_RESET% Normal One
        set ANSI_TEST_STRING_3=%BIG_TEXT_LINE_2%big% %ANSI_RESET% Normal Two

@DHowett DHowett changed the title advanced ansi emulation - blinking doesn't work in conjunction with faint SGR Blinking doesn't work in conjunction with Faint Jul 7, 2023
@DHowett
Copy link
Member

DHowett commented Jul 7, 2023

Great catch!

@j4james I remember we (you!) made the conscious decision to use faint colors for blink rather than e.g. libvte's "text is invisible while blink-off". I've got some ideas on how to handle this one:

  1. make it even fainter!
  2. treat it as concealed if it was already faint and blink is blinked-off

Is there precedent, or preference, on your side? 😄

@DHowett DHowett added Area-VT Virtual Terminal sequence support Product-Terminal The new Windows Terminal. Priority-2 A description (P2) labels Jul 7, 2023
@DHowett DHowett added this to the Backlog milestone Jul 7, 2023
@ClaireCJS
Copy link
Author

ClaireCJS commented Jul 7, 2023

Oh i think it should blink to fainter color

If it blinked to a brighter color, there's the danger of blink+faint looking the same as normal+faint, but simply inverted. At that point, it's literally the same as blink+reverse. Poo. It should be a unique and recognizable entity: blinking just like a normal blink, but faint just like faint.

And if it just became invisible, it would be the same as conceal and basically have none of the nature of blink and very little of the nature of faint.

so #1: make it even fainter!

@ClaireCJS
Copy link
Author

Side-comment, your ansi support is GORGEOUS and i feel like i'm in the late 1980s vt100 terminal (because i used those) days again, never thought i'd see double-height text again, thank you :)

image

@DHowett
Copy link
Member

DHowett commented Jul 7, 2023

And if it just became invisible, it would be the same as conceal and basically have none of the nature of blink and very little of the nature of faint.

Well, it would still be visible half the time! Point taken, though. 😄

thank you

90% of this was James' work, and he's the G.O.A.T.

@ClaireCJS
Copy link
Author

And if it just became invisible, it would be the same as conceal and basically have none of the nature of blink and very little of the nature of faint.

Well, it would still be visible half the time! Point taken, though.

Ohhh, I mis-understood. Doesn't change my answer to which option I think is better, but gives me more respect for that option 😅

90% of this was James' work, and he's the G.O.A.T.

Thank you James!!!!!! 🎉🎉🎉

@j4james
Copy link
Collaborator

j4james commented Jul 8, 2023

Thanks for raising this @ClaireCJS. Although it's obvious in retrospect I don't think I realised at the time that this combination wouldn't work. I'm happy with the idea of making the blinking faint even fainter. 1

That said, I'm in the process of overhauling a lot of the rendition code at the moment, because I'm trying to implement the DECSTGLT color mapping tables, and fixing other areas of the attribute rendition that aren't entirely compatible with the VT525. So it may be a while before I've got something working again, but I'll try and make sure the new architecture is capable of handling this correctly.

Footnotes

  1. Just FYI, the only DEC terminal I'm aware of that supported the faint rendition was the VK100, and that implemented the "off" blinking state as entirely invisible. But that was regardless of whether the faint attribute was set or not, so it doesn't make sense for us to copy that.

@ClaireCJS
Copy link
Author

Thanks for raising this @ClaireCJS. Although it's obvious in retrospect I don't think I realised at the time that this combination wouldn't work.

I really did stumble upon it by accident!

That said, I'm in the process of overhauling a lot of the rendition code at the moment, because I'm trying to implement the DECSTGLT color mapping tables, and fixing other areas of the attribute rendition that aren't entirely compatible with the VT525. So it may be a while before I've got something working again, but I'll try and make sure the new architecture is capable of handling this correctly.

Wow. That sounds really fun, though.

Footnotes

  1. Just FYI, the only DEC terminal I'm aware of that supported the faint rendition was the VK100, and that implemented the "off" blinking state as entirely invisible. But that was regardless of whether the faint attribute was set or not, so it doesn't make sense for us to copy that.

Anyone else getting Doctor Who/Quantum Leap vibes? It's like you're getting to fix history's mistakes! :) 🎉🎉🎉

@PankajBhojwani PankajBhojwani removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Jul 12, 2023
@nerdatwork
Copy link

@ClaireCJS I tried using “$($PSStyle.Blink) Hello World” on my Windows Terminal but it wont show any blinking text. What could cause that issue ?

@ClaireCJS
Copy link
Author

ClaireCJS commented Sep 9, 2023

@ClaireCJS I tried using “$($PSStyle.Blink) Hello World” on my Windows Terminal but it wont show any blinking text. What could cause that issue ?

I typically just print the actual ANSI codes to STDOUT without using any packages.

Try both fast & slow blink codes.
Make sure you're focused into the window (blinking stops when you click out).

BLINK_FAST_ON=←[6m
BLINK_SLOW_ON=←[5m
BLINK_OFF=←[25m

@ClaireCJS
Copy link
Author

And if all else fails, pipe it through cygwin's cat.exe

that almost always fixes ANSI rendering problems!

@nerdatwork
Copy link

Even "e[5m HELLO" won't work. I have WT 1.17.xxx too. I am so lost. I can't use cygwin as I will be deploying my code on client's computer. I dont want client to download anything more than powershell.

@j4james
Copy link
Collaborator

j4james commented Sep 10, 2023

@nerdatwork If you're using Windows PowerShell you need something like this:

"$([char]27)[5m HELLO $([char]27)[m"

And on newer versions of PowerShell you can use this:

"`e[5m HELLO `e[m"

If you still can't see the text blinking, it may be because you have Windows animations disabled. You'll find that option somewhere in your Windows settings, typically in the Ease of Access or Accessibility section. Just search for animations and you should find it. Also make sure you haven't set the cursor blink rate to None, because that will also disable text blinking.

The other reason you may not be seeing blinking is if you're accessing a remote computer with Remote Desktop. If that's the case, open the Options page before you start the connection, and look under the Experience tab. You should find a Menu and window animation option there.

And note that you may need to restart Windows Terminal after changing any of these settings.

@nerdatwork
Copy link

nerdatwork commented Sep 10, 2023

@j4james Thank you. It was the Show animations in Windows setting that needed to be turned on. This fixed it. Yay! 3 days of troubleshooting comes to a happy ending 😄 Maybe this should be part of the MS documentation around Blink property.

image

PS: Anyone else facing this issue, don't forget to restart Windows Terminal for new changes to take effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-VT Virtual Terminal sequence support Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) Product-Terminal The new Windows Terminal.
Projects
None yet
Development

No branches or pull requests

5 participants