Underline ANSI escape sequence does not work with space before reset sequence #9693

Closed
opened 2026-01-31 02:01:05 +00:00 by claunia · 5 comments
Owner

Originally created by @patriksvensson on GitHub (Jul 20, 2020).

I've noticed that using ANSI escape sequence ESC[4mFOO ESC[0m does not underline the text as expected.
If I remove the space before the reset code ESC[0m, it works as expected.

This works as expected in cmd.exe/powershell.exe (which I assume both uses conhost), conemu and cmder.

Environment

Windows build number: Microsoft Windows NT 10.0.19041.0
Windows Terminal version (if applicable): 1.0.1811.0

Steps to reproduce

  1. Open PowerShell console in Windows Terminal
  2. Run Write-Host "$([char]27)[1mBold$([char]27)[0m $([char]27)[4mUnderline$([char]27)[0m Normal"
    This underlines the text "Underline" as expected.
  3. Run Write-Host "$([char]27)[1mBold $([char]27)[0m$([char]27)[4mUnderline$([char]27)[0m Normal"
    This fails with underlining the text.

They say that a picture is worth a thousand words, so here's a screenshot as well of the repro.

image

Expected behavior

In the third step in the repro, I would expect the text Underline to be underlined.

Actual behavior

The text Underline is not underlined.

Originally created by @patriksvensson on GitHub (Jul 20, 2020). I've noticed that using ANSI escape sequence `ESC[4mFOO ESC[0m` does not underline the text as expected. If I remove the space before the reset code `ESC[0m`, it works as expected. This works as expected in `cmd.exe`/`powershell.exe` (which I assume both uses conhost), `conemu` and `cmder`. # Environment ```none Windows build number: Microsoft Windows NT 10.0.19041.0 Windows Terminal version (if applicable): 1.0.1811.0 ``` # Steps to reproduce 1. Open PowerShell console in Windows Terminal 2. Run `Write-Host "$([char]27)[1mBold$([char]27)[0m $([char]27)[4mUnderline$([char]27)[0m Normal"` *This underlines the text "Underline" as expected.* 3. Run `Write-Host "$([char]27)[1mBold $([char]27)[0m$([char]27)[4mUnderline$([char]27)[0m Normal"` *This fails with underlining the text.* They say that a picture is worth a thousand words, so here's a screenshot as well of the repro. ![image](https://user-images.githubusercontent.com/357872/87888639-45686f80-ca2e-11ea-93e8-9190ca76ec54.png) # Expected behavior In the third step in the repro, I would expect the text `Underline` to be underlined. # Actual behavior The text `Underline` is not underlined.
claunia added the Resolution-Duplicate label 2026-01-31 02:01:05 +00:00
Author
Owner

@DHowett commented on GitHub (Jul 20, 2020):

I believe this was fixed in #6506 (I know it says color, but it applies to all attributes.). I can't reproduce this, or a very similar vim issue (changing colors/changing rendition but not toggling underline turned underline off), after 6506 with the about-to-come-out 1.2 previe

@DHowett commented on GitHub (Jul 20, 2020): I _believe_ this was fixed in #6506 (I know it says color, but it applies to all attributes.). I can't reproduce this, or a very similar vim issue (changing colors/changing rendition but not toggling underline turned underline off), after 6506 with the about-to-come-out 1.2 previe
Author
Owner

@DHowett commented on GitHub (Jul 20, 2020):

If you can build from source, would you mind validating that? If not, no big deal 😄

@DHowett commented on GitHub (Jul 20, 2020): If you can build from source, would you mind validating that? If not, no big deal :smile:
Author
Owner

@DHowett commented on GitHub (Jul 20, 2020):

(For now, /dup #3076)

@DHowett commented on GitHub (Jul 20, 2020): (For now, /dup #3076)
Author
Owner

@ghost commented on GitHub (Jul 20, 2020):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (Jul 20, 2020): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Author
Owner

@patriksvensson commented on GitHub (Jul 20, 2020):

@DHowett I can reproduce #3076 (which have been fixed) so hopefully, that fix will fix my problem. I will build Windows Terminal from the source tomorrow and verify it.

image

@patriksvensson commented on GitHub (Jul 20, 2020): @DHowett I can reproduce #3076 (which have been fixed) so hopefully, that fix will fix my problem. I will build Windows Terminal from the source tomorrow and verify it. ![image](https://user-images.githubusercontent.com/357872/87889485-2835a000-ca32-11ea-9959-c7183bfc3ad3.png)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#9693