[PATCH 5/5] riched20: Handle EM_FINDTEXTEX's unicode conversion in the host.
Huw Davies
huw at codeweavers.com
Fri Mar 12 03:01:38 CST 2021
Signed-off-by: Huw Davies <huw at codeweavers.com>
---
dlls/riched20/editor.c | 19 +------------------
dlls/riched20/txthost.c | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 93daa472048..eb1ec78d962 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -4167,30 +4167,13 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
{
return editor->nTextLimit;
}
- case EM_FINDTEXTEX:
- {
- LRESULT r;
- if(!unicode){
- FINDTEXTEXA *ex = (FINDTEXTEXA *)lParam;
- int nChars = MultiByteToWideChar(CP_ACP, 0, ex->lpstrText, -1, NULL, 0);
- WCHAR *tmp;
-
- if ((tmp = heap_alloc(nChars * sizeof(*tmp))) != NULL)
- MultiByteToWideChar(CP_ACP, 0, ex->lpstrText, -1, tmp, nChars);
- r = ME_FindText(editor, wParam, &ex->chrg, tmp, &ex->chrgText);
- heap_free(tmp);
- }else{
- FINDTEXTEXW *ex = (FINDTEXTEXW *)lParam;
- r = ME_FindText(editor, wParam, &ex->chrg, ex->lpstrText, &ex->chrgText);
- }
- return r;
- }
case EM_FINDTEXT:
case EM_FINDTEXTW:
{
FINDTEXTW *ft = (FINDTEXTW *)lParam;
return ME_FindText(editor, wParam, &ft->chrg, ft->lpstrText, NULL);
}
+ case EM_FINDTEXTEX:
case EM_FINDTEXTEXW:
{
FINDTEXTEXW *ex = (FINDTEXTEXW *)lParam;
diff --git a/dlls/riched20/txthost.c b/dlls/riched20/txthost.c
index 00801b5b9af..d249137d829 100644
--- a/dlls/riched20/txthost.c
+++ b/dlls/riched20/txthost.c
@@ -850,6 +850,27 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
if (!unicode) ME_EndToUnicode( CP_ACP, (WCHAR *)new_params.lpstrText );
break;
}
+ case EM_FINDTEXTEX:
+ {
+ FINDTEXTEXA *paramsA = (FINDTEXTEXA *)lparam;
+ FINDTEXTEXW *params = (FINDTEXTEXW *)lparam;
+ FINDTEXTEXW 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_FINDTEXTEXW, wparam, (LPARAM)params, &res );
+ if (!unicode)
+ {
+ ME_EndToUnicode( CP_ACP, (WCHAR *)new_params.lpstrText );
+ paramsA->chrgText = params->chrgText;
+ }
+ break;
+ }
case WM_GETTEXT:
{
GETTEXTEX params;
--
2.23.0
More information about the wine-devel
mailing list