mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-10 00:48:23 -06:00
Fix typing multiple emojis on Windows 10 (#17213)
On Windows 10 Emojis don't finish composition until the Emoji picker panel is closed. Each emoji is thus its own composition range. `firstRange` thus caused only the first emoji to finish composition. The end result was that all remaining emojis would stay around forever, with the user entirely unable to clear them. ## Validation Steps Performed * Windows 10 VM * Open Emoji picker (Win+.) * Press and hold Enter on any Emoji * Press Esc to finish the composition * All of the Emoji can be backspaced / deleted
This commit is contained in:
parent
dbac3a1fa3
commit
49e4eea60f
@ -436,7 +436,7 @@ void Implementation::_doCompositionUpdate(TfEditCookie ec)
|
|||||||
std::wstring finalizedString;
|
std::wstring finalizedString;
|
||||||
std::wstring activeComposition;
|
std::wstring activeComposition;
|
||||||
til::small_vector<Render::CompositionRange, 2> activeCompositionRanges;
|
til::small_vector<Render::CompositionRange, 2> activeCompositionRanges;
|
||||||
bool firstRange = true;
|
bool activeCompositionEncountered = false;
|
||||||
|
|
||||||
const GUID* guids[] = { &GUID_PROP_COMPOSING, &GUID_PROP_ATTRIBUTE };
|
const GUID* guids[] = { &GUID_PROP_COMPOSING, &GUID_PROP_ATTRIBUTE };
|
||||||
wil::com_ptr<ITfReadOnlyProperty> props;
|
wil::com_ptr<ITfReadOnlyProperty> props;
|
||||||
@ -500,7 +500,9 @@ void Implementation::_doCompositionUpdate(TfEditCookie ec)
|
|||||||
ULONG len = bufCap;
|
ULONG len = bufCap;
|
||||||
THROW_IF_FAILED(range->GetText(ec, TF_TF_MOVESTART, buf, len, &len));
|
THROW_IF_FAILED(range->GetText(ec, TF_TF_MOVESTART, buf, len, &len));
|
||||||
|
|
||||||
if (!composing && firstRange)
|
// Since we can't un-finalize finalized text, we only finalize text that's at the start of the document.
|
||||||
|
// In other words, don't put text that's in the middle between two active compositions into the finalized string.
|
||||||
|
if (!composing && !activeCompositionEncountered)
|
||||||
{
|
{
|
||||||
finalizedString.append(buf, len);
|
finalizedString.append(buf, len);
|
||||||
}
|
}
|
||||||
@ -520,7 +522,7 @@ void Implementation::_doCompositionUpdate(TfEditCookie ec)
|
|||||||
const auto attr = _textAttributeFromAtom(atom);
|
const auto attr = _textAttributeFromAtom(atom);
|
||||||
activeCompositionRanges.emplace_back(totalLen, attr);
|
activeCompositionRanges.emplace_back(totalLen, attr);
|
||||||
|
|
||||||
firstRange = false;
|
activeCompositionEncountered |= composing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user