Commit ad056fe7 authored by Dylan Smith's avatar Dylan Smith Committed by Alexandre Julliard

richedit: Check for bits instead of equality in EM_SETCHARFORMAT.

There are unsupported flags documented on MSDN which would cause problems for the equality checks used in EM_SETCHARFORMAT. Also, to handle a combined set of flags they must be checked for in the right order.
parent 16d78904
...@@ -3359,26 +3359,27 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, ...@@ -3359,26 +3359,27 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
BOOL bRepaint = TRUE; BOOL bRepaint = TRUE;
p = ME_ToCF2W(&buf, (CHARFORMAT2W *)lParam); p = ME_ToCF2W(&buf, (CHARFORMAT2W *)lParam);
if (p == NULL) return 0; if (p == NULL) return 0;
if (!wParam) if (wParam & SCF_ALL) {
ME_SetDefaultCharFormat(editor, p); if (editor->mode & TM_PLAINTEXT) {
else if (wParam == (SCF_WORD | SCF_SELECTION)) {
FIXME("EM_SETCHARFORMAT: word selection not supported\n");
return 0;
} else if (wParam == SCF_ALL) {
if (editor->mode & TM_PLAINTEXT)
ME_SetDefaultCharFormat(editor, p); ME_SetDefaultCharFormat(editor, p);
else { } else {
ME_Cursor start; ME_Cursor start;
ME_SetCursorToStart(editor, &start); ME_SetCursorToStart(editor, &start);
ME_SetCharFormat(editor, &start, NULL, p); ME_SetCharFormat(editor, &start, NULL, p);
editor->nModifyStep = 1; editor->nModifyStep = 1;
} }
} else if (editor->mode & TM_PLAINTEXT) { } else if (wParam & SCF_SELECTION) {
return 0; if (editor->mode & TM_PLAINTEXT)
} else { return 0;
if (wParam & SCF_WORD) {
FIXME("EM_SETCHARFORMAT: word selection not supported\n");
return 0;
}
bRepaint = ME_IsSelection(editor); bRepaint = ME_IsSelection(editor);
ME_SetSelectionCharFormat(editor, p); ME_SetSelectionCharFormat(editor, p);
if (bRepaint) editor->nModifyStep = 1; if (bRepaint) editor->nModifyStep = 1;
} else { /* SCF_DEFAULT */
ME_SetDefaultCharFormat(editor, p);
} }
ME_CommitUndo(editor); ME_CommitUndo(editor);
if (bRepaint) if (bRepaint)
......
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