1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-17 00:44:19 +00:00

MacOS: Fix TextEditor when using marked text (e.g. Korean)

This commit is contained in:
attila 2021-12-06 23:44:35 +01:00
parent 87061fb751
commit 2b3abd3ca6
2 changed files with 16 additions and 0 deletions

View file

@ -1531,6 +1531,15 @@ public:
void textInputRequired (Point<int>, TextInputTarget&) override {}
void dismissPendingTextInput() override
{
stringBeingComposed.clear();
const auto* inputContext = [NSTextInputContext currentInputContext];
if (inputContext != nil)
[inputContext discardMarkedText];
}
void resetWindowPresentation()
{
if (hasNativeTitleBar())

View file

@ -1836,6 +1836,9 @@ void TextEditor::mouseDown (const MouseEvent& e)
{
moveCaretTo (getTextIndexAt (e.x, e.y),
e.mods.isShiftDown());
if (auto* peer = getPeer())
peer->dismissPendingTextInput();
}
else
{
@ -1956,6 +1959,10 @@ bool TextEditor::moveCaretWithTransaction (const int newPos, const bool selectin
{
newTransaction();
moveCaretTo (newPos, selecting);
if (auto* peer = getPeer())
peer->dismissPendingTextInput();
return true;
}