Dylan Smith : richedit: Check for bits instead of equality in EM_SETCHARFORMAT.
Alexandre Julliard
julliard at winehq.org
Fri Jul 30 10:24:12 CDT 2010
Module: wine
Branch: master
Commit: ad056fe7d785bc41fdab57a642818fed73f6d709
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ad056fe7d785bc41fdab57a642818fed73f6d709
Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date: Thu Jul 29 14:05:58 2010 -0400
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.
---
dlls/riched20/editor.c | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 842b159..48b64c9 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -3359,26 +3359,27 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
BOOL bRepaint = TRUE;
p = ME_ToCF2W(&buf, (CHARFORMAT2W *)lParam);
if (p == NULL) return 0;
- if (!wParam)
- ME_SetDefaultCharFormat(editor, p);
- 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)
+ if (wParam & SCF_ALL) {
+ if (editor->mode & TM_PLAINTEXT) {
ME_SetDefaultCharFormat(editor, p);
- else {
+ } else {
ME_Cursor start;
ME_SetCursorToStart(editor, &start);
ME_SetCharFormat(editor, &start, NULL, p);
editor->nModifyStep = 1;
}
- } else if (editor->mode & TM_PLAINTEXT) {
- return 0;
- } else {
+ } else if (wParam & SCF_SELECTION) {
+ if (editor->mode & TM_PLAINTEXT)
+ return 0;
+ if (wParam & SCF_WORD) {
+ FIXME("EM_SETCHARFORMAT: word selection not supported\n");
+ return 0;
+ }
bRepaint = ME_IsSelection(editor);
ME_SetSelectionCharFormat(editor, p);
if (bRepaint) editor->nModifyStep = 1;
+ } else { /* SCF_DEFAULT */
+ ME_SetDefaultCharFormat(editor, p);
}
ME_CommitUndo(editor);
if (bRepaint)
More information about the wine-cvs
mailing list