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

ANSI escape sequences rendered in error messages #20805

Open
ibuclaw opened this issue Jan 30, 2025 · 4 comments
Open

ANSI escape sequences rendered in error messages #20805

ibuclaw opened this issue Jan 30, 2025 · 4 comments

Comments

@ibuclaw
Copy link
Member

ibuclaw commented Jan 30, 2025

This doesn't look like it should be intended behaviour.

static assert(0, "\x1b[31mThis should be red");

https://compiler-explorer.com/z/9f5oKM1j9

@thewilsonator
Copy link
Contributor

@dkorpel did you fix this?

@dkorpel
Copy link
Contributor

dkorpel commented Feb 20, 2025

No, the string contents of static assert messages / pragma msg is still passed directly to stderr.

I'm contemplating what the best fix is here: we could filter out these characters, but when the user explicitly puts these in the message, why not respect that? In that case, just resetting the color after printing a static assert message will do.

Are there other funky characters we should watch out for?

@thewilsonator
Copy link
Contributor

direction overrides (LtR, RtL)?, cc @rikkimax anything else that comes to mind?

@rikkimax
Copy link
Contributor

In general, I would say if people are putting ANSI escape sequences in their outputs from DMD, that's on them.

However, what does come to mind is that dub has code that converts ANSI escape sequences to the Windows API call equivalent.
This may be of interest.

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

4 participants