Huw Davies : riched20: Use EM_GETTEXTLENGTHEX to implement WM_GETTEXTLENGTH.

Alexandre Julliard julliard at winehq.org
Fri Mar 12 14:36:15 CST 2021


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Fri Mar 12 09:01:34 2021 +0000

riched20: Use EM_GETTEXTLENGTHEX to implement WM_GETTEXTLENGTH.

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

---

 dlls/riched20/editor.c  | 4 +---
 dlls/riched20/txthost.c | 9 +++++++++
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 217394eaafb..6532f7c65cb 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -3969,10 +3969,8 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
   case WM_GETTEXTLENGTH:
   {
     GETTEXTLENGTHEX how;
-
-    /* CR/LF conversion required in 2.0 mode, verbatim in 1.0 mode */
     how.flags = GTL_CLOSE | (editor->bEmulateVersion10 ? 0 : GTL_USECRLF) | GTL_NUMCHARS;
-    how.codepage = unicode ? CP_UNICODE : CP_ACP;
+    how.codepage = CP_UNICODE;
     return ME_GetTextLengthEx(editor, &how);
   }
   case EM_GETTEXTLENGTHEX:
diff --git a/dlls/riched20/txthost.c b/dlls/riched20/txthost.c
index 064ce3fb827..e401759991f 100644
--- a/dlls/riched20/txthost.c
+++ b/dlls/riched20/txthost.c
@@ -801,6 +801,15 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
             FillRect( hdc, &rc, editor->hbrBackground );
         return 1;
     }
+    case WM_GETTEXTLENGTH:
+    {
+        GETTEXTLENGTHEX params;
+
+        params.flags = GTL_CLOSE | (host->emulate_10 ? 0 : GTL_USECRLF) | GTL_NUMCHARS;
+        params.codepage = unicode ? CP_UNICODE : CP_ACP;
+        hr = ITextServices_TxSendMessage( host->text_srv, EM_GETTEXTLENGTHEX, (WPARAM)&params, 0, &res );
+        break;
+    }
     case WM_PAINT:
     {
         HDC hdc;




More information about the wine-cvs mailing list