diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index cacad463963..3d17d2d974f 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -2744,11 +2744,8 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey) return FALSE; } -static LRESULT ME_Char(ME_TextEditor *editor, WPARAM charCode, - LPARAM flags, BOOL unicode) +static LRESULT handle_wm_char( ME_TextEditor *editor, WCHAR wstr, LPARAM flags ) { - WCHAR wstr; - if (editor->bMouseCaptured) return 0; @@ -2758,14 +2755,6 @@ static LRESULT ME_Char(ME_TextEditor *editor, WPARAM charCode, return 0; /* FIXME really 0 ? */ } - if (unicode) - wstr = (WCHAR)charCode; - else - { - CHAR charA = charCode; - MultiByteToWideChar(CP_ACP, 0, &charA, 1, &wstr, 1); - } - if (editor->bEmulateVersion10 && wstr == '\r') handle_enter(editor); @@ -4379,7 +4368,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, if ((editor->nEventMask & ENM_KEYEVENTS) && !ME_FilterEvent(editor, msg, &wParam, &lParam)) return 0; - return ME_Char(editor, wParam, lParam, unicode); + return handle_wm_char( editor, wParam, lParam ); case WM_UNICHAR: if (unicode) { @@ -4389,11 +4378,11 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, if(wParam > 0xffff) /* convert to surrogates */ { wParam -= 0x10000; - ME_Char(editor, (wParam >> 10) + 0xd800, 0, TRUE); - ME_Char(editor, (wParam & 0x03ff) + 0xdc00, 0, TRUE); - } else { - ME_Char(editor, wParam, 0, TRUE); + handle_wm_char( editor, (wParam >> 10) + 0xd800, 0 ); + handle_wm_char( editor, (wParam & 0x03ff) + 0xdc00, 0 ); } + else + handle_wm_char( editor, wParam, 0 ); } return 0; } diff --git a/dlls/riched20/txthost.c b/dlls/riched20/txthost.c index 17b6daf7517..ac561ef4c83 100644 --- a/dlls/riched20/txthost.c +++ b/dlls/riched20/txthost.c @@ -780,6 +780,14 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam, editor = host->editor; switch (msg) { + case WM_CHAR: + { + WCHAR wc = wparam; + + if (!unicode) MultiByteToWideChar( CP_ACP, 0, (char *)&wparam, 1, &wc, 1 ); + hr = ITextServices_TxSendMessage( host->text_srv, msg, wc, lparam, &res ); + break; + } case WM_DESTROY: ITextHost_Release( &host->ITextHost_iface ); return 0;