vcl/win/window/salframe.cxx |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit af0da68b4176aaf6d2f6faed66446e5638f41c80
Author:     Jonathan Clark <jonat...@libreoffice.org>
AuthorDate: Fri Aug 1 04:07:12 2025 -0600
Commit:     Jonathan Clark <jonat...@libreoffice.org>
CommitDate: Fri Aug 1 21:29:38 2025 +0200

    tdf#167740 vcl: Fix Win IME inserting stale composition after dismissal
    
    Related to tdf#155158: Previously, the Microsoft Pinyin IME failed to
    send WM_IME_ENDCOMPOSITION when dismissed during composition. As a
    result of this, LO became stuck in an IME input state (resulting in, for
    example, an invisible cursor). The fix for this bug was to treat
    dismissing the IME in this state as also ending composition.
    
    Unfortunately, in the case of the Windows 10 Microsoft Korean IME, this
    bug fix caused the last character to be repeated due to stale
    composition state. This change updates the previous fix to also clear
    this data prior to ending composition.
    
    Change-Id: I5b2906c54af495e238a8335cc9c21cb42f6f3beb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188754
    Tested-by: Jenkins
    Reviewed-by: Jonathan Clark <jonat...@libreoffice.org>

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 9fd8d2fd6f7b..e5a3a38bb4fb 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -5391,6 +5391,12 @@ static bool ImplHandleIMEEndComposition( HWND hWnd )
 
         // tdf#155158: Windows IMEs do not necessarily send a composition 
message if they are
         // dismissed during composition (for example, by an input 
method/language change).
+        // tdf#167740: Also clear the candidate text when the IME is dismissed.
+        SalExtTextInputEvent aEvt;
+        aEvt.mpTextAttr = nullptr;
+        aEvt.mnCursorPos = 0;
+        aEvt.mnCursorFlags = 0;
+        pFrame->CallCallback(SalEvent::ExtTextInput, &aEvt);
         pFrame->CallCallback(SalEvent::EndExtTextInput, nullptr);
     }
 

Reply via email to