-
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
Add support for the "concealed" graphic rendition attribute #6876
Comments
Philosophically, if it's not copyable and not rendered in xterm, is there any meaningful difference between it being concealed and it simply not existing? For us, matching the colors and leaving it copyable sounds great. I'm r+ on this proposal! |
That depends on the implementation. If they're still writing the text to the buffer, then it could potentially be revealed through other means, e.g. by changing the attributes with Anyway I don't think it matters much. This is one of those things that doesn't have a clear right answer, because the ANSI/ECMA specs don't go into any detail, and the DEC terminals never had this functionality. I figure as long as we're doing what most others are doing then we're probably OK. |
Observe, furthermore, that kitty extends |
That's good to know - thanks for pointing that out. I was under the impression that none of the DEC terminals supported the concealed/invisible attribute, possibly because it's not listed in the functions summary table of the VT520 Programmer Reference. But I see now that even the VT420 supported it.
Yeah I saw that, but I thought (incorrectly) that that was just because they didn't support the concealed attribute in general. I suppose it's still possible that was an oversight in the docs.
I thought XTerm did that too (see here), but as I mentioned above I couldn't get it to work. I don't think I tested |
## Summary of the Pull Request This PR adds support for the `SGR 8` and `SGR 28` escape sequences, which enable and disable the _concealed/invisible_ graphic rendition attribute. When a character is output with this attribute set, it is rendered with the same foreground and background colors, so the text is essentially invisible. ## PR Checklist * [x] Closes #6876 * [x] CLA signed. * [x] Tests added/passed * [ ] Documentation updated. * [ ] Schema updated. * [x] I've discussed this with core contributors already. Issue number where discussion took place: #6876 ## Detailed Description of the Pull Request / Additional comments Most of the framework for this attribute was already implemented, so it was just a matter of updating the `TextAttribute::CalculateRgbColors` method to make the foreground the same as the background when the _Invisible_ flag was set. Note that this has to happen after the _Reverse Video_ attribute is applied, so if you have white-on-black text that is reversed and invisible, it should be all white, rather than all black. ## Validation Steps Performed There were already existing SGR unit tests covering this attribute in the `ScreenBufferTests`, and the `VtRendererTest`. But I've added to the `AdapterTest` which verifies the SGR sequences for setting and resetting the attribute, and I've extended the `TextAttributeTests` to verify that the color calculations return the correct values when the attribute is set. I've also manually confirmed that we now render the _concealed text_ values correctly in the _ISO 6429_ tests in Vttest. And I've manually tested the output of _concealed_ when combined with other attributes, and made sure that we're matching the behaviour of most other terminals.
🎉This issue was addressed in #6907, which has now been successfully released as Handy links: |
🎉 As of Windows Insider build 20197, this is also supported in the traditional console. |
Description of the new feature/enhancement
The ANSI
SGR 8
rendition attribute is used to indicate that text to which it's applied should be rendered invisible. I'm not sure how widely it's used, but it is supported by most terminal emulators, so I think it's probably worth doing. And most of the framework is already in place, so it's an easy addition for us.Proposed technical implementation details (optional)
I think all that's required is an update to the
TextAttribute::CalculateRgbColors
method, adjusting the colors to make the foreground and background the same when the attribute is set. Something like:In testing this on other terminals, I found that XTerm also prevented the invisible content being copied to the clipboard. However, pretty much everyone else allowed it to be copied, so I'm more inclined to follow the majority behaviour.
I have a PR ready to submit for this if you're happy with the idea and the proposed approach, but it'd be best if #6873 is merged first, otherwise there'll probably be conflicts in the unit tests.
The text was updated successfully, but these errors were encountered: