Skip to content

Handling Missing Numbers in ANSI Escape Sequences #44

@GaryDYelle

Description

@GaryDYelle
  • Your Windows build number: (Type ver at a Windows Command Prompt)

Microsoft Windows [Version 10.0.16299.125]

  • What you're doing and what's happening: (Copy & paste specific commands and their output, or include screen shots)
test@PC2:~$ printf "\033[31mtest\n"
test (red)
test@PC2:~$ printf "\033[31;mtest\n"
test (red)
test@PC2:~$ printf "\033[31;0mtest\n"
test (white)
test@PC2:~$
  • What's wrong
    The second output is printed in red:

wsl

  • What should be happening instead:

The second output should be printed in white like on Linux:

wsl2

According to Wikipedia (https://en.wikipedia.org/wiki/ANSI_escape_code):

All common sequences just use the parameters as a series of semicolon-separated numbers such as 1;2;3. Missing numbers are treated as 0 (1;;3 acts like the middle number is 0, and no parameters at all in ESC[m acts like a 0 reset code).

Further details are available from:
https://superuser.com/questions/1280903/how-to-enable-colors-with-win32-openssh-and-putty

Metadata

Metadata

Assignees

Labels

Product-ConhostFor issues in the Console codebase

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions