Module: wine Branch: master Commit: 1fa39b50c0bafeb72e85c257391e6cd5fb70182d URL: http://source.winehq.org/git/wine.git/?a=commit;h=1fa39b50c0bafeb72e85c25739...
Author: Alex Villacís Lasso a_villacis@palosanto.com Date: Sun Apr 27 13:08:55 2008 -0500
richedit: Only notify selection change when selection has actually changed from previous notification.
Otherwise, redundant and early notifications are sent to apps that do not expect them. Fixes crash #1 with Perfect! TextEdit.
---
dlls/riched20/caret.c | 10 +++++++++- dlls/riched20/editor.c | 2 ++ dlls/riched20/editstr.h | 3 +++ 3 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index bf53aff..b2172ac 100644 --- a/dlls/riched20/caret.c +++ b/dlls/riched20/caret.c @@ -1330,7 +1330,15 @@ void ME_SendSelChange(ME_TextEditor *editor) sc.seltyp |= SEL_TEXT; if (sc.chrg.cpMin < sc.chrg.cpMax+1) /* wth were RICHEDIT authors thinking ? */ sc.seltyp |= SEL_MULTICHAR; - SendMessageW(GetParent(editor->hWnd), WM_NOTIFY, sc.nmhdr.idFrom, (LPARAM)&sc); + TRACE("cpMin=%d cpMax=%d seltyp=%d (%s %s)\n", + sc.chrg.cpMin, sc.chrg.cpMax, sc.seltyp, + (sc.seltyp & SEL_TEXT) ? "SEL_TEXT" : "", + (sc.seltyp & SEL_MULTICHAR) ? "SEL_MULTICHAR" : ""); + if (sc.chrg.cpMin != editor->notified_cr.cpMin || sc.chrg.cpMax != editor->notified_cr.cpMax) + { + editor->notified_cr = sc.chrg; + SendMessageW(GetParent(editor->hWnd), WM_NOTIFY, sc.nmhdr.idFrom, (LPARAM)&sc); + } }
BOOL diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 3121293..660942f 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -1665,6 +1665,8 @@ ME_TextEditor *ME_MakeEditor(HWND hWnd) { else ed->cPasswordMask = 0;
+ ed->notified_cr.cpMin = ed->notified_cr.cpMax = 0; + return ed; }
diff --git a/dlls/riched20/editstr.h b/dlls/riched20/editstr.h index aedaefa..1e2c770 100644 --- a/dlls/riched20/editstr.h +++ b/dlls/riched20/editstr.h @@ -331,6 +331,9 @@ typedef struct tagME_TextEditor /*for IME */ int imeStartIndex; DWORD selofs, linesel, sely; + + /* Track previous notified selection */ + CHARRANGE notified_cr; } ME_TextEditor;
typedef struct tagME_Context