Module: wine Branch: master Commit: 03f3a40a03dedb9f2162cf64fe96f3464fcace34 URL: http://source.winehq.org/git/wine.git/?a=commit;h=03f3a40a03dedb9f2162cf64fe...
Author: Alex Villacís Lasso a_villacis@palosanto.com Date: Wed Sep 26 15:50:45 2007 -0500
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 4efaa90..fcfe03a 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 416c803..0ec7da4 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*/