Add support for the "concealed" graphic rendition attribute #9562

Open
opened 2026-01-31 01:57:51 +00:00 by claunia · 0 comments
Owner

Originally created by @j4james on GitHub (Jul 11, 2020).

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:

if (IsInvisible())
{
    fg = bg;
}

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.

Originally created by @j4james on GitHub (Jul 11, 2020). # 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: if (IsInvisible()) { fg = bg; } 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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#9562