Huw Davies : riched20: Handle EM_FINDTEXT's unicode conversion in the host.
Alexandre Julliard
julliard at winehq.org
Fri Mar 12 14:36:15 CST 2021
Module: wine
Branch: master
Commit: c80be66cc45cd1c8afc4164560d8679615891815
URL: https://source.winehq.org/git/wine.git/?a=commit;h=c80be66cc45cd1c8afc4164560d8679615891815
Author: Huw Davies <huw at codeweavers.com>
Date: Fri Mar 12 09:01:37 2021 +0000
riched20: Handle EM_FINDTEXT'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 | 19 +------------------
dlls/riched20/txthost.c | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index f96f52ef56d..93daa472048 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -4167,24 +4167,6 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
{
return editor->nTextLimit;
}
- case EM_FINDTEXT:
- {
- LRESULT r;
- if(!unicode){
- FINDTEXTA *ft = (FINDTEXTA *)lParam;
- int nChars = MultiByteToWideChar(CP_ACP, 0, ft->lpstrText, -1, NULL, 0);
- WCHAR *tmp;
-
- if ((tmp = heap_alloc(nChars * sizeof(*tmp))) != NULL)
- MultiByteToWideChar(CP_ACP, 0, ft->lpstrText, -1, tmp, nChars);
- r = ME_FindText(editor, wParam, &ft->chrg, tmp, NULL);
- heap_free(tmp);
- }else{
- FINDTEXTW *ft = (FINDTEXTW *)lParam;
- r = ME_FindText(editor, wParam, &ft->chrg, ft->lpstrText, NULL);
- }
- return r;
- }
case EM_FINDTEXTEX:
{
LRESULT r;
@@ -4203,6 +4185,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
}
return r;
}
+ case EM_FINDTEXT:
case EM_FINDTEXTW:
{
FINDTEXTW *ft = (FINDTEXTW *)lParam;
diff --git a/dlls/riched20/txthost.c b/dlls/riched20/txthost.c
index 3c968ddfecc..00801b5b9af 100644
--- a/dlls/riched20/txthost.c
+++ b/dlls/riched20/txthost.c
@@ -834,6 +834,22 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
FillRect( hdc, &rc, editor->hbrBackground );
return 1;
}
+ case EM_FINDTEXT:
+ {
+ FINDTEXTW *params = (FINDTEXTW *)lparam;
+ FINDTEXTW new_params;
+ int len;
+
+ if (!unicode)
+ {
+ new_params.chrg = params->chrg;
+ new_params.lpstrText = ME_ToUnicode( CP_ACP, (char *)params->lpstrText, &len );
+ params = &new_params;
+ }
+ hr = ITextServices_TxSendMessage( host->text_srv, EM_FINDTEXTW, wparam, (LPARAM)params, &res );
+ if (!unicode) ME_EndToUnicode( CP_ACP, (WCHAR *)new_params.lpstrText );
+ break;
+ }
case WM_GETTEXT:
{
GETTEXTEX params;
More information about the wine-cvs
mailing list