Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typing multiple emojis on Windows 10 #17213

Merged
merged 3 commits into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/tsf/Implementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ void Implementation::_doCompositionUpdate(TfEditCookie ec)
std::wstring finalizedString;
std::wstring activeComposition;
til::small_vector<Render::CompositionRange, 2> activeCompositionRanges;
bool firstRange = true;
bool activeCompositionEncountered = false;

const GUID* guids[] = { &GUID_PROP_COMPOSING, &GUID_PROP_ATTRIBUTE };
wil::com_ptr<ITfReadOnlyProperty> props;
Expand Down Expand Up @@ -500,7 +500,9 @@ void Implementation::_doCompositionUpdate(TfEditCookie ec)
ULONG len = bufCap;
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);
lhecker marked this conversation as resolved.
Show resolved Hide resolved
}
Expand All @@ -520,7 +522,7 @@ void Implementation::_doCompositionUpdate(TfEditCookie ec)
const auto attr = _textAttributeFromAtom(atom);
activeCompositionRanges.emplace_back(totalLen, attr);

firstRange = false;
activeCompositionEncountered |= composing;
}
}

Expand Down
Loading