[2/2] richedit: Support ascii RTF in WM_SETTEXT even for unicode messages. (Bug 18510)

Dylan Smith dylan.ah.smith at gmail.com
Fri Jul 10 22:54:34 CDT 2009


WM_SETTEXT seems to check for {\rtf or {\urtf to determine if it is an
ascii RTF string, even if it is a unicode message.  So I removed the
check to see if it is a unicode message, and added a check for {\urtf.

This patch also fixes a harmless typo that added an extra '}' character
in a strncmp string for "{\urtf".
---
 dlls/riched20/editor.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
-------------- next part --------------
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 278b9aa..4cd72c8 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -3194,7 +3194,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
     /* If we detect ascii rtf at the start of the string,
      * we know it isn't unicode. */
     bRtf = (lParam && (!strncmp((char *)lParam, "{\\rtf", 5) ||
-                         !strncmp((char *)lParam, "{\\urtf}", 6)));
+                         !strncmp((char *)lParam, "{\\urtf", 6)));
     bUnicode = !bRtf && pStruct->codepage == 1200;
 
     TRACE("EM_SETTEXTEX - %s, flags %d, cp %d\n",
@@ -3463,7 +3463,8 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
     if (lParam)
     {
       TRACE("WM_SETTEXT lParam==%lx\n",lParam);
-      if (!unicode && !strncmp((char *)lParam, "{\\rtf", 5))
+      if (!strncmp((char *)lParam, "{\\rtf", 5) ||
+          !strncmp((char *)lParam, "{\\urtf", 6))
       {
         /* Undocumented: WM_SETTEXT supports RTF text */
         ME_StreamInRTFString(editor, 0, (char *)lParam);


More information about the wine-patches mailing list