Skip to content
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

Render the SGR "underlined" attribute in the style of the font #7148

Merged
3 commits merged into from
Aug 3, 2020

Conversation

j4james
Copy link
Collaborator

@j4james j4james commented Aug 1, 2020

This PR updates the rendering of the underlined graphic rendition
attribute, using the style specified in the active font, instead of just
reusing the grid line at the bottom of the character cell.

There was already an ExtendedAttributes flag defined for the
underlined state, but I needed to update the SetUnderlined and
IsUnderlined methods in the TextAttribute class to use that flag
now in place of the legacy LVB_UNDERSCORE attribute. This enables
underlines set via a VT sequence to be tracked separately from
LVB_UNDERSCORE grid lines set via the console API.

I then needed to update the Renderer::s_GetGridlines method to
activate the GridLines::Underline style when the Underlined
attribute was set. The GridLines::Bottom style is still triggered by
the LVB_UNDERSCORE attribute to produce the bottom grid line effect.

Validation

Because this is a change from the existing behaviour, certain unit tests
that were expecting the LVB_UNDERSCORE to be toggled by SGR 4 and
SGR 24 have now had to be updated to check the Underlined flag
instead.

There were also some UI Automation tests that were checking for SGR 4
mapping to LVB_UNDERSCORE attribute, which I've now substituted with a
test of the SGR 53 overline attribute mapping to
LVB_GRID_HORIZONTAL. These tests only work with legacy attributes, so
they can't access the extended underline state, and I thought a
replacement test that covered similar ground would be better than
dropping the tests altogether.

As far as the visual rendering is concerned, I've manually confirmed
that the VT underline sequences now draw the underline in the correct
position and style, while grid lines output via the console API are
still displayed in their original form.

Closes #2915

@ghost ghost added Area-VT Virtual Terminal sequence support Issue-Task It's a feature request, but it doesn't really need a major design. Product-Conhost For issues in the Console codebase labels Aug 1, 2020
@DHowett
Copy link
Member

DHowett commented Aug 2, 2020

@msftbot make sure @zadjii-msft signs off

@ghost ghost added the AutoMerge Marked for automatic merge by the bot when requirements are met label Aug 2, 2020
@ghost
Copy link

ghost commented Aug 2, 2020

Hello @DHowett!

Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:

  • I'll only merge this pull request if it's approved by @zadjii-msft

If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you".

@DHowett
Copy link
Member

DHowett commented Aug 2, 2020

See, this is way more comprehensive than my "2 files changed" hack hour 😄

Thanks @j4james

@DHowett
Copy link
Member

DHowett commented Aug 2, 2020

(don't mind me editing your pr bodies -- it's purely aesthetic for when the bot takes over the merge 😄)

@ghost ghost merged commit 158a170 into microsoft:master Aug 3, 2020
@j4james j4james deleted the update-sgr-underline branch August 8, 2020 20:03
@ghost
Copy link

ghost commented Aug 26, 2020

🎉Windows Terminal Preview v1.3.2382.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-VT Virtual Terminal sequence support AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Task It's a feature request, but it doesn't really need a major design. Product-Conhost For issues in the Console codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Underlined independent of LVB_UNDERSCORE
3 participants