Commit 1fa39b50 authored by Alex Villacís Lasso's avatar Alex Villacís Lasso Committed by Alexandre Julliard

richedit: Only notify selection change when selection has actually changed from…

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.
parent cac55008
...@@ -1330,7 +1330,15 @@ void ME_SendSelChange(ME_TextEditor *editor) ...@@ -1330,7 +1330,15 @@ void ME_SendSelChange(ME_TextEditor *editor)
sc.seltyp |= SEL_TEXT; sc.seltyp |= SEL_TEXT;
if (sc.chrg.cpMin < sc.chrg.cpMax+1) /* wth were RICHEDIT authors thinking ? */ if (sc.chrg.cpMin < sc.chrg.cpMax+1) /* wth were RICHEDIT authors thinking ? */
sc.seltyp |= SEL_MULTICHAR; 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 BOOL
......
...@@ -1665,6 +1665,8 @@ ME_TextEditor *ME_MakeEditor(HWND hWnd) { ...@@ -1665,6 +1665,8 @@ ME_TextEditor *ME_MakeEditor(HWND hWnd) {
else else
ed->cPasswordMask = 0; ed->cPasswordMask = 0;
ed->notified_cr.cpMin = ed->notified_cr.cpMax = 0;
return ed; return ed;
} }
......
...@@ -331,6 +331,9 @@ typedef struct tagME_TextEditor ...@@ -331,6 +331,9 @@ typedef struct tagME_TextEditor
/*for IME */ /*for IME */
int imeStartIndex; int imeStartIndex;
DWORD selofs, linesel, sely; DWORD selofs, linesel, sely;
/* Track previous notified selection */
CHARRANGE notified_cr;
} ME_TextEditor; } ME_TextEditor;
typedef struct tagME_Context typedef struct tagME_Context
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment