-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Unexpected behaviour when bold and reverse ANSI attributes are combined #128
Comments
Might be related to #136 I'll investigate. |
Hey wadda you know, this was in fact a dupe of #136. It's already in code review! |
Huh. It looks like maybe this got undone by another change? I have been doing a LOT of bugfixes in this area as of late, so there's too much churn to effectively find where this regressed. I'll reactivate a bug on this to get it in for 19H1. MSFT:19956461 |
My test case was written with the assumption of "standard" default colors (7 foreground, 0 background). Using non-standard default colors just confuses the issue. A more robust test case would look like this:
All I'm trying to determine is whether it's the foreground or the background color that is affected by the bold/bright attribute when the negative attribute is also set. My expectation was that the brightness would always apply to the foreground color. So white on black, negative, bold would be black on white, with the black foreground brightened, rather than the white background being brightened. That said, I wouldn't want to claim that that is necessarily the correct interpretation. There clearly are some terminal emulators that apply the bright attribute to the background. I was initially only testing against the Linux virtual terminal and DOS, because I expected that was the behaviour you'd likely want to follow. And in both of those cases a bright background would never have been an option (the text mode of a typical PC video card couldn't support bright background colors, since the forth bit of the background attribute was used to trigger the flashing mode). But if you're more interested in compatibility with xterm, then a bright background may well be the right choice for you. Although the actual xterm behaviour is stranger than that - the text becomes bold and the background becomes bright, which seems really odd to me. TLDR: If the decision to make the background color bright was deliberate, then you're welcome to close this issue again. It's just not what I was expecting, and I though that you had initially agreed with me. |
Sorry to necro this crazy old thread, but I'm just coming back around on this one. Since it seems like there's not really a consensus on what the right behavior is, I'm going to say this is "by design". If as an ecosystem there's a more unified behavior here, then I'd be happy to re-open to do it right. But since there's not really a right behavior, I can't really fix it. |
I've missed this bugreport so far – I'm going through all of @j4james's bugreports right now in the hope of catching some VTE bugs :D Coincidentally, the same question occurred to me a couple of weeks ago, and I summarized my findings at https://bugzilla.gnome.org/show_bug.cgi?id=791596#c5. IMO the only reasonable move is to push for leaving the "bold is bright" mess behind, and aim for full separation of font weight vs. colors (which I've already mentioned in one or two others issues here). Then we'll no longer have this dilemma. |
Windows build number: [Version 10.0.16299.248]
The ANSI sequence
\033[1;7m
sets both the bold (increased intensity) attribute and the negative/reverse attribute, but when those attributes are combined, I'd expected the increased intensity to apply to the final foreground color (i.e. after the colors have been reversed), so you'd get "bright" black on regular white, rather than black on bright white.The former behaviour is what I see under MS-DOS (with ANSI.SYS) and the Linux console. But the Windows console applies the increased intensity to the foreground before the colors are reversed, so you end up with black on bright white instead.
Test case (from a bash shell):
printf "\033[0;1;7m ACTUAL \033[0;1;30;47m EXPECTED \033[m\n"
I realise things are more complicated under Windows, since many more colors are supported, so it's possible this is intentional behaviour. However, I thought it best to bring it up in case it is a bug.
Also note that I'm referring to the behaviour as seen in a fresh console window. Things get weirder once you apply a 24-bit color and trigger the strange mode reported in issue #78. I'm not sure if the fix for that issue is likely to effect this behaviour too.
The text was updated successfully, but these errors were encountered: