Add support for passing through extended text attributes, like… (#2917)

## Summary of the Pull Request
Adds support for Italics, Blinking, Invisible, CrossedOut text, THROUGH CONPTY. This does **NOT** add support for those styles to conhost or the terminal.

We will store these "Extended Text Attributes" in a `TextAttribute`. When we go to render a line, we'll see if the state has changed from our previous state, and if so, we'll appropriately toggle that state with VT. Boldness has been moved from a `bool` to a single bit in these flags.

Technically, now that these are stored in the buffer, we only need to make changes to the renderers to be able to support them. That's not being done as a part of this PR however.

## References
See also #2915 and #2916, which are some follow-up tasks from this fix. I thought them too risky for 20H1.

## PR Checklist
* [x] Closes #2554
* [x] I work here
* [x] Tests added/passed
* [n/a] Requires documentation to be updated


<hr>

* store text with extended attributes too

* Plumb attributes through all the renderers

* parse extended attrs, though we're not renderering them right

* Render these states correctly

* Add a very extensive test

* Cleanup for PR

* a block of PR feedback

* add 512 test cases

* Fix the build

* Fix @carlos-zamora's suggestions

* @miniksa's PR feedback
This commit is contained in:
Mike Griese
2019-10-04 15:53:54 -05:00
committed by GitHub
parent 53c81a08f8
commit dec5c11e19
35 changed files with 938 additions and 112 deletions

View File

@@ -44,7 +44,7 @@ COLORREF TextAttribute::CalculateRgbBackground(std::basic_string_view<COLORREF>
COLORREF TextAttribute::_GetRgbForeground(std::basic_string_view<COLORREF> colorTable,
COLORREF defaultColor) const noexcept
{
return _foreground.GetColor(colorTable, defaultColor, _isBold);
return _foreground.GetColor(colorTable, defaultColor, IsBold());
}
// Routine Description:
@@ -155,11 +155,6 @@ void TextAttribute::SetColor(const COLORREF rgbColor, const bool fIsForeground)
}
}
bool TextAttribute::IsBold() const noexcept
{
return _isBold;
}
bool TextAttribute::_IsReverseVideo() const noexcept
{
return WI_IsFlagSet(_wAttrLegacy, COMMON_LVB_REVERSE_VIDEO);
@@ -215,6 +210,11 @@ void TextAttribute::Debolden() noexcept
_SetBoldness(false);
}
void TextAttribute::SetExtendedAttributes(const ExtendedAttributes attrs) noexcept
{
_extendedAttrs = attrs;
}
// Routine Description:
// - swaps foreground and background color
void TextAttribute::Invert() noexcept
@@ -224,7 +224,7 @@ void TextAttribute::Invert() noexcept
void TextAttribute::_SetBoldness(const bool isBold) noexcept
{
_isBold = isBold;
WI_UpdateFlag(_extendedAttrs, ExtendedAttributes::Bold, isBold);
}
void TextAttribute::SetDefaultForeground() noexcept