From 03f3a40a03dedb9f2162cf64fe96f3464fcace34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Villac=C3=ADs=20Lasso?= Date: Wed, 26 Sep 2007 15:50:45 -0500 Subject: [PATCH] riched20: EM_SETCHARFORMAT must fail and return 0 with TM_PLAINTEXT and SF_SELECTION. --- dlls/riched20/editor.c | 16 +++++++++++----- dlls/riched20/tests/editor.c | 10 +++++++--- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 4efaa9001f9..fcfe03acf6c 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -1733,13 +1733,19 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, BOOL bRepaint = TRUE; p = ME_ToCF2W(&buf, (CHARFORMAT2W *)lParam); if (p == NULL) return 0; - if (!wParam || (editor->mode & TM_PLAINTEXT)) + if (!wParam) ME_SetDefaultCharFormat(editor, p); - else if (wParam == (SCF_WORD | SCF_SELECTION)) + else if (wParam == (SCF_WORD | SCF_SELECTION)) { FIXME("EM_SETCHARFORMAT: word selection not supported\n"); - else if (wParam == SCF_ALL) - ME_SetCharFormat(editor, 0, ME_GetTextLength(editor), p); - else { + return 0; + } else if (wParam == SCF_ALL) { + if (editor->mode & TM_PLAINTEXT) + ME_SetDefaultCharFormat(editor, p); + else + ME_SetCharFormat(editor, 0, ME_GetTextLength(editor), p); + } else if (editor->mode & TM_PLAINTEXT) { + return 0; + } else { int from, to; ME_GetSelection(editor, &from, &to); bRepaint = (from != to); diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index 416c8034618..0ec7da45702 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -572,9 +572,13 @@ static void test_TM_PLAINTEXT(void) cf2.dwEffects = CFE_BOLD ^ cf2.dwEffects; rc = SendMessage(hwndRichEdit, EM_SETCHARFORMAT, (WPARAM) SCF_SELECTION, (LPARAM) &cf2); - todo_wine { - ok(rc == 0, "EM_SETCHARFORMAT returned %d instead of 0\n", rc); - } + ok(rc == 0, "EM_SETCHARFORMAT returned %d instead of 0\n", rc); + + rc = SendMessage(hwndRichEdit, EM_SETCHARFORMAT, (WPARAM) SCF_WORD | SCF_SELECTION, (LPARAM) &cf2); + ok(rc == 0, "EM_SETCHARFORMAT returned %d instead of 0\n", rc); + + rc = SendMessage(hwndRichEdit, EM_SETCHARFORMAT, (WPARAM) SCF_ALL, (LPARAM)&cf2); + ok(rc == 1, "EM_SETCHARFORMAT returned %d instead of 1\n", rc); /*Get the formatting of those characters*/