Skip to content

Commit da05714

Browse files
lheckerDHowett
authored andcommitted
Improve TSF color filtering logic (re: QQPinyin) (#19117)
If an IME provider sets both `crText` and `crBk` we should respect this, but the previous logic would incorrectly assert for `crLine != TF_CT_NONE`. ## Validation Steps Performed ❌ I'm not aware which TSF even sets these colors in a way that's compatible with us in the first place... (cherry picked from commit f2b30b4) Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgck4T8 Service-Version: 1.22
1 parent e4eb338 commit da05714

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/tsf/Implementation.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -719,17 +719,12 @@ TextAttribute Implementation::_textAttributeFromAtom(TfGuidAtom atom) const
719719
// the others is likely not properly tested anyway, so we reject those cases.
720720
// After all, what behavior do we expect, if the IME sends e.g. foreground=blue,
721721
// without knowing whether our terminal theme already uses a blue background?
722-
if (da.crText.type == da.crBk.type && da.crText.type == da.crLine.type)
722+
if (da.crText.type != TF_CT_NONE && da.crText.type == da.crBk.type)
723723
{
724-
if (da.crText.type != TF_CT_NONE)
725-
{
726-
attr.SetForeground(_colorFromDisplayAttribute(da.crText));
727-
}
728-
if (da.crBk.type != TF_CT_NONE)
729-
{
730-
attr.SetBackground(_colorFromDisplayAttribute(da.crBk));
731-
}
732-
if (da.crLine.type != TF_CT_NONE)
724+
attr.SetForeground(_colorFromDisplayAttribute(da.crText));
725+
attr.SetBackground(_colorFromDisplayAttribute(da.crBk));
726+
// I'm not sure what the best way to handle this is.
727+
if (da.crText.type == da.crLine.type)
733728
{
734729
attr.SetUnderlineColor(_colorFromDisplayAttribute(da.crLine));
735730
}

0 commit comments

Comments
 (0)