@@ -711,13 +711,28 @@ TextAttribute Implementation::_textAttributeFromAtom(TfGuidAtom atom) const
711
711
TF_DISPLAYATTRIBUTE da;
712
712
THROW_IF_FAILED (dai->GetAttributeInfo (&da));
713
713
714
- if (da.crText .type != TF_CT_NONE)
715
- {
716
- attr.SetForeground (_colorFromDisplayAttribute (da.crText ));
717
- }
718
- if (da.crBk .type != TF_CT_NONE)
719
- {
720
- attr.SetBackground (_colorFromDisplayAttribute (da.crBk ));
714
+ // The Tencent QQPinyin IME creates TF_CT_COLORREF attributes with a color of 0x000000 (black).
715
+ // We respect their wish, which results in the preview text being invisible.
716
+ // (Note that sending this COLORREF is incorrect, and not a bug in our handling.)
717
+ //
718
+ // After some discussion, we realized that an IME which sets only one color but not
719
+ // the others is likely not properly tested anyway, so we reject those cases.
720
+ // After all, what behavior do we expect, if the IME sends e.g. foreground=blue,
721
+ // 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 )
723
+ {
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)
733
+ {
734
+ attr.SetUnderlineColor (_colorFromDisplayAttribute (da.crLine ));
735
+ }
721
736
}
722
737
if (da.lsStyle >= TF_LS_NONE && da.lsStyle <= TF_LS_SQUIGGLE)
723
738
{
@@ -737,10 +752,6 @@ TextAttribute Implementation::_textAttributeFromAtom(TfGuidAtom atom) const
737
752
{
738
753
attr.SetUnderlineStyle (UnderlineStyle::DoublyUnderlined);
739
754
}
740
- if (da.crLine .type != TF_CT_NONE)
741
- {
742
- attr.SetUnderlineColor (_colorFromDisplayAttribute (da.crLine ));
743
- }
744
755
745
756
return attr;
746
757
}
0 commit comments