Skip to content

Add support for the faint (SGR 2) rendition - #1404

Open
trevorbernard wants to merge 1 commit into
mobile-shell:masterfrom
trevorbernard:faint-rendition
Open

Add support for the faint (SGR 2) rendition#1404
trevorbernard wants to merge 1 commit into
mobile-shell:masterfrom
trevorbernard:faint-rendition

Conversation

@trevorbernard

Copy link
Copy Markdown

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().

This change gives SGR 2 its own case and emits ;2 alongside 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.

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.
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

Successfully merging this pull request may close these issues.

1 participant