Browse Source

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

v6.1.6
attila 3 years ago
parent
commit
2b3abd3ca6
2 changed files with 16 additions and 0 deletions
  1. +9
    -0
      modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm
  2. +7
    -0
      modules/juce_gui_basics/widgets/juce_TextEditor.cpp

+ 9
- 0
modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm View File

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


+ 7
- 0
modules/juce_gui_basics/widgets/juce_TextEditor.cpp View File

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


Loading…
Cancel
Save