From e5f5dc60a7d271504d61dd63ff8737f547d7be59 Mon Sep 17 00:00:00 2001 From: Dylan Smith Date: Tue, 16 Dec 2008 03:43:43 -0500 Subject: [PATCH] richedit: Removed some unnecessary SendMessage calls to itself. --- dlls/riched20/caret.c | 6 ++---- dlls/riched20/editor.c | 11 ++++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index 4a3ec8cd40b..6cb3cbbd781 100644 --- a/dlls/riched20/caret.c +++ b/dlls/riched20/caret.c @@ -1565,11 +1565,9 @@ void ME_SendSelChange(ME_TextEditor *editor) if (!(editor->nEventMask & ENM_SELCHANGE)) return; - - sc.nmhdr.hwndFrom = editor->hWnd; - sc.nmhdr.idFrom = GetWindowLongW(editor->hWnd, GWLP_ID); + sc.nmhdr.code = EN_SELCHANGE; - SendMessageW(editor->hWnd, EM_EXGETSEL, 0, (LPARAM)&sc.chrg); + ME_GetSelection(editor, &sc.chrg.cpMin, &sc.chrg.cpMax); sc.seltyp = SEL_EMPTY; if (sc.chrg.cpMin != sc.chrg.cpMax) sc.seltyp |= SEL_TEXT; diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index d5d382bbf91..b1b956d0526 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -1426,7 +1426,7 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre ME_DisplayItem *para_item; style = editor->pBuffer->pDefaultStyle; ME_AddRefStyle(style); - SendMessageA(editor->hWnd, EM_SETSEL, 0, 0); + ME_SetSelection(editor, 0, 0); ME_InternalDeleteText(editor, 0, ME_GetTextLength(editor), FALSE); from = to = 0; ME_ClearTempStyle(editor); @@ -1559,7 +1559,7 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre ME_GetSelection(editor, &to, &to2); /* put the cursor at the top */ if (!(format & SFF_SELECTION)) - SendMessageA(editor->hWnd, EM_SETSEL, 0, 0); + ME_SetSelection(editor, 0, 0); } /* Restore saved undo mode */ @@ -4063,7 +4063,12 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, LRESULT ret; int mask = 0; int changes = 0; - ret = RichEditWndProc_common(hWnd, WM_GETTEXTLENGTH, 0, 0, unicode); + 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 ? 1200 : CP_ACP; + ret = ME_GetTextLengthEx(editor, &how); if (!ret) { /*Check for valid wParam*/