diff --git a/.github/actions/spelling/allow/allow.txt b/.github/actions/spelling/allow/allow.txt index f9a16af64d..b347ec85b9 100644 --- a/.github/actions/spelling/allow/allow.txt +++ b/.github/actions/spelling/allow/allow.txt @@ -24,8 +24,8 @@ dze dzhe Emacspeak Fitt -FTCS flac +FTCS gantt gfm ghe @@ -61,8 +61,8 @@ Powerline ptys pwn pwshw -QOL qof +QOL qps quickfix rclt @@ -82,6 +82,7 @@ stakeholders subpage sustainability sxn +Tencent TLDR tonos toolset diff --git a/src/tsf/Implementation.cpp b/src/tsf/Implementation.cpp index f2cd958933..6f2e249755 100644 --- a/src/tsf/Implementation.cpp +++ b/src/tsf/Implementation.cpp @@ -711,13 +711,28 @@ TextAttribute Implementation::_textAttributeFromAtom(TfGuidAtom atom) const TF_DISPLAYATTRIBUTE da; THROW_IF_FAILED(dai->GetAttributeInfo(&da)); - if (da.crText.type != TF_CT_NONE) + // The Tencent QQPinyin IME creates TF_CT_COLORREF attributes with a color of 0x000000 (black). + // We respect their wish, which results in the preview text being invisible. + // (Note that sending this COLORREF is incorrect, and not a bug in our handling.) + // + // After some discussion, we realized that an IME which sets only one color but not + // the others is likely not properly tested anyway, so we reject those cases. + // After all, what behavior do we expect, if the IME sends e.g. foreground=blue, + // without knowing whether our terminal theme already uses a blue background? + if (da.crText.type == da.crBk.type && da.crText.type == da.crLine.type) { - attr.SetForeground(_colorFromDisplayAttribute(da.crText)); - } - if (da.crBk.type != TF_CT_NONE) - { - attr.SetBackground(_colorFromDisplayAttribute(da.crBk)); + if (da.crText.type != TF_CT_NONE) + { + attr.SetForeground(_colorFromDisplayAttribute(da.crText)); + } + if (da.crBk.type != TF_CT_NONE) + { + attr.SetBackground(_colorFromDisplayAttribute(da.crBk)); + } + if (da.crLine.type != TF_CT_NONE) + { + attr.SetUnderlineColor(_colorFromDisplayAttribute(da.crLine)); + } } if (da.lsStyle >= TF_LS_NONE && da.lsStyle <= TF_LS_SQUIGGLE) { @@ -737,10 +752,6 @@ TextAttribute Implementation::_textAttributeFromAtom(TfGuidAtom atom) const { attr.SetUnderlineStyle(UnderlineStyle::DoublyUnderlined); } - if (da.crLine.type != TF_CT_NONE) - { - attr.SetUnderlineColor(_colorFromDisplayAttribute(da.crLine)); - } return attr; }