Huw Davies : riched20: Handle WM_SETTEXT's unicode conversion in the host.

Alexandre Julliard julliard at winehq.org
Thu Mar 11 15:59:34 CST 2021


Module: wine
Branch: master
Commit: 21fc1b530d4499d71a32d861bed201094e0529d9
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=21fc1b530d4499d71a32d861bed201094e0529d9

Author: Huw Davies <huw at codeweavers.com>
Date:   Thu Mar 11 08:51:01 2021 +0000

riched20: Handle WM_SETTEXT's unicode conversion in the host.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/riched20/editor.c  |  2 +-
 dlls/riched20/txthost.c | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 9ac5d49a3db..cacad463963 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -3953,7 +3953,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
         ME_StreamInRTFString(editor, 0, (char *)lParam);
       }
       else
-        ME_SetText(editor, (void*)lParam, unicode);
+        ME_SetText( editor, (void*)lParam, TRUE );
     }
     else
       TRACE("WM_SETTEXT - NULL\n");
diff --git a/dlls/riched20/txthost.c b/dlls/riched20/txthost.c
index 9f183def2dd..17b6daf7517 100644
--- a/dlls/riched20/txthost.c
+++ b/dlls/riched20/txthost.c
@@ -865,6 +865,18 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
         SetWindowLongW( hwnd, GWL_STYLE, style );
         return res;
     }
+    case WM_SETTEXT:
+    {
+        char *textA = (char *)lparam;
+        WCHAR *text = (WCHAR *)lparam;
+        int len;
+
+        if (!unicode && textA && strncmp( textA, "{\\rtf", 5 ) && strncmp( textA, "{\\urtf", 6 ))
+            text = ME_ToUnicode( CP_ACP, textA, &len );
+        hr = ITextServices_TxSendMessage( host->text_srv, msg, wparam, (LPARAM)text, &res );
+        if (text != (WCHAR *)lparam) ME_EndToUnicode( CP_ACP, text );
+        break;
+    }
     default:
         res = ME_HandleMessage( editor, msg, wparam, lparam, unicode, &hr );
     }




More information about the wine-cvs mailing list