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

HelpBuilder.WrapText wraps incorrectly when the text contains VT100 escape sequences #1996

Open
rvuistin opened this issue Dec 16, 2022 · 2 comments

Comments

@rvuistin
Copy link
Contributor

rvuistin commented Dec 16, 2022

It would be nice to support colors in the help engine.

Similar problem as #1973, but this time taking in account that an escape sequence does not use any space in the terminal

@KalleOlaviNiemitalo
Copy link

See also #1962 (comment) regarding two-column wrapping with control sequences.

@KalleOlaviNiemitalo
Copy link

KalleOlaviNiemitalo commented Dec 20, 2022

Would these be tolerable restrictions:

  • Only Set Graphics Rendition (SGR) is supported.
  • The control sequence must start with ESC [ rather than a single CSI character.
  • The line-wrapping logic does not try to understand any parameter values within the SGR control sequence, except it understands that SGR with no parameters resets to default.

So if the text were "a b\x1B[31;42mc d\x1B[37me f\x1B[mg h", and it had to be wrapped at each space character, then the resulting lines would be "a", "b\x1B[31;42mc\x1B[m", "\x1B[31;42md\x1B[37me\x1B[m", "\x1B[31;42m\x1B[37mf\x1B[mg", and "h". Although the parameter 37 fully overrides the preceding 31, the line wrapper would not understand that and it would keep both of them.

By not attempting to understand the parameter values, the line-wrapping logic would be immune to whether subparameters in an ITU T.416 RGB color parameter are delimited with colons or semicolons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants