Dylan Smith : richedit: Removed some unnecessary SendMessage calls to itself.

Alexandre Julliard julliard at winehq.org
Tue Dec 16 08:40:43 CST 2008


Module: wine
Branch: master
Commit: e5f5dc60a7d271504d61dd63ff8737f547d7be59
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e5f5dc60a7d271504d61dd63ff8737f547d7be59

Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date:   Tue Dec 16 03:43:43 2008 -0500

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 4a3ec8c..6cb3cbb 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 d5d382b..b1b956d 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*/




More information about the wine-cvs mailing list