Add support for the faint (SGR 2) rendition - #1404
Open
trevorbernard wants to merge 1 commit into
Open
Conversation
The faint attribute was declared in Renditions::attribute_type but never read or written anywhere: set_rendition() had no case for SGR 2, so the parameter fell through to the "ignore unknown rendition" default, and sgr() had no branch to emit it. Faint text was therefore indistinguishable from normal text both on screen and on the wire, since Display::new_frame builds the network payload from sgr(). Give SGR 2 its own case and emit ";2" alongside the other attributes. Per ECMA-48, SGR 22 selects normal intensity and cancels both bold and faint, so split it out of the case it shared with SGR 1 and have it clear both. Extend the truecolor attribute test with a faint block; that test enumerates every attribute we support and compares the rendering against tmux.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The faint attribute was declared in
Renditions::attribute_typebut never read or written anywhere:set_rendition()had no case for SGR 2, so the parameter fell through to the "ignore unknown rendition" default, andsgr()had no branch to emit it. Faint text was therefore indistinguishable from normal text both on screen and on the wire, sinceDisplay::new_framebuilds the network payload fromsgr().This change gives SGR 2 its own case and emits
;2alongside the other attributes. Per ECMA-48, SGR 22 selects normal intensity and cancels both bold and faint, so it is split out of the case it shared with SGR 1 and now clears both.The truecolor attribute test is extended with a faint block; that test enumerates every attribute mosh supports and compares the rendering against tmux.