mirror of
https://github.com/reactos/wine.git
synced 2024-12-01 07:30:37 +00:00
richedit: Simplify redundant code in WM_IME_COMPOSITION.
This commit is contained in:
parent
e809bc887d
commit
3f1d3e0ea1
@ -4257,30 +4257,22 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
|
||||
hIMC = ITextHost_TxImmGetContext(editor->texthost);
|
||||
ME_DeleteSelection(editor);
|
||||
ME_SaveTempStyle(editor);
|
||||
if (lParam & GCS_RESULTSTR)
|
||||
if (lParam & (GCS_RESULTSTR|GCS_COMPSTR))
|
||||
{
|
||||
LPWSTR lpCompStr = NULL;
|
||||
DWORD dwBufLen;
|
||||
DWORD dwIndex = lParam & GCS_RESULTSTR;
|
||||
if (!dwIndex)
|
||||
dwIndex = GCS_COMPSTR;
|
||||
|
||||
dwBufLen = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, NULL, 0);
|
||||
dwBufLen = ImmGetCompositionStringW(hIMC, dwIndex, NULL, 0);
|
||||
lpCompStr = HeapAlloc(GetProcessHeap(),0,dwBufLen + sizeof(WCHAR));
|
||||
ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, lpCompStr, dwBufLen);
|
||||
ImmGetCompositionStringW(hIMC, dwIndex, lpCompStr, dwBufLen);
|
||||
lpCompStr[dwBufLen/sizeof(WCHAR)] = 0;
|
||||
ME_InsertTextFromCursor(editor,0,lpCompStr,dwBufLen/sizeof(WCHAR),style);
|
||||
HeapFree(GetProcessHeap(), 0, lpCompStr);
|
||||
}
|
||||
else if (lParam & GCS_COMPSTR)
|
||||
{
|
||||
LPWSTR lpCompStr = NULL;
|
||||
DWORD dwBufLen;
|
||||
|
||||
dwBufLen = ImmGetCompositionStringW(hIMC, GCS_COMPSTR, NULL, 0);
|
||||
lpCompStr = HeapAlloc(GetProcessHeap(),0,dwBufLen + sizeof(WCHAR));
|
||||
ImmGetCompositionStringW(hIMC, GCS_COMPSTR, lpCompStr, dwBufLen);
|
||||
lpCompStr[dwBufLen/sizeof(WCHAR)] = 0;
|
||||
|
||||
ME_InsertTextFromCursor(editor,0,lpCompStr,dwBufLen/sizeof(WCHAR),style);
|
||||
HeapFree(GetProcessHeap(), 0, lpCompStr);
|
||||
if (dwIndex == GCS_COMPSTR)
|
||||
ME_SetSelection(editor,editor->imeStartIndex,
|
||||
editor->imeStartIndex + dwBufLen/sizeof(WCHAR));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user