mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-10 00:48:23 -06:00
Fix support for the Tencent QQPinyin IME (#19046)
(cherry picked from commit b47fdfc7e63fd7c2f8c060a1abc930b3fc40fc19) Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgbjZ8E Service-Version: 1.22
This commit is contained in:
parent
5dbae6b362
commit
7c9841604d
3
.github/actions/spelling/allow/allow.txt
vendored
3
.github/actions/spelling/allow/allow.txt
vendored
@ -21,6 +21,7 @@ dze
|
||||
dzhe
|
||||
Emacspeak
|
||||
Fitt
|
||||
flac
|
||||
FTCS
|
||||
gantt
|
||||
ghe
|
||||
@ -56,6 +57,7 @@ ptys
|
||||
pwn
|
||||
pwshw
|
||||
qof
|
||||
QOL
|
||||
qps
|
||||
quickfix
|
||||
rclt
|
||||
@ -74,6 +76,7 @@ slnt
|
||||
stakeholders
|
||||
sustainability
|
||||
sxn
|
||||
Tencent
|
||||
TLDR
|
||||
tonos
|
||||
toolset
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user