diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index b5d1df5..b592464 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -2479,13 +2479,15 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, return tmp.dwMask; } case EM_SETPARAFORMAT: - ME_SetSelectionParaFormat(editor, (PARAFORMAT2 *)lParam); + { + BOOL result = ME_SetSelectionParaFormat(editor, (PARAFORMAT2 *)lParam); ME_RewrapRepaint(editor); ME_CommitUndo(editor); - return 0; + return result; + } case EM_GETPARAFORMAT: ME_GetSelectionParaFormat(editor, (PARAFORMAT2 *)lParam); - return 0; + return ((PARAFORMAT2 *)lParam)->dwMask; case EM_GETFIRSTVISIBLELINE: { ME_DisplayItem *p = editor->pBuffer->pFirst; diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index a32811c..797f415 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -222,8 +222,8 @@ ME_DisplayItem *ME_JoinParagraphs(ME_TextEditor *editor, ME_DisplayItem *tp, BOOL keepFirstParaFormat); void ME_DumpParaStyle(ME_Paragraph *s); void ME_DumpParaStyleToBuf(const PARAFORMAT2 *pFmt, char buf[2048]); -void ME_SetParaFormat(ME_TextEditor *editor, ME_DisplayItem *para, const PARAFORMAT2 *pFmt); -void ME_SetSelectionParaFormat(ME_TextEditor *editor, const PARAFORMAT2 *pFmt); +BOOL ME_SetParaFormat(ME_TextEditor *editor, ME_DisplayItem *para, const PARAFORMAT2 *pFmt); +BOOL ME_SetSelectionParaFormat(ME_TextEditor *editor, const PARAFORMAT2 *pFmt); void ME_GetParaFormat(ME_TextEditor *editor, const ME_DisplayItem *para, PARAFORMAT2 *pFmt); void ME_GetSelectionParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt); /* marks from first up to (but not including) last */ diff --git a/dlls/riched20/para.c b/dlls/riched20/para.c index 5289fdd..88d8623 100644 --- a/dlls/riched20/para.c +++ b/dlls/riched20/para.c @@ -322,7 +322,7 @@ void ME_DumpParaStyleToBuf(const PARAFORMAT2 *pFmt, char buf[2048]) #undef DUMP_EFFECT } -void ME_SetParaFormat(ME_TextEditor *editor, ME_DisplayItem *para, const PARAFORMAT2 *pFmt) +BOOL ME_SetParaFormat(ME_TextEditor *editor, ME_DisplayItem *para, const PARAFORMAT2 *pFmt) { PARAFORMAT2 copy; assert(sizeof(*para->member.para.pFmt) == sizeof(PARAFORMAT2)); @@ -379,6 +379,8 @@ void ME_SetParaFormat(ME_TextEditor *editor, ME_DisplayItem *para, const PARAFOR if (memcmp(©, para->member.para.pFmt, sizeof(PARAFORMAT2))) para->member.para.nFlags |= MEPF_REWRAP; + + return TRUE; } @@ -406,7 +408,7 @@ ME_GetSelectionParas(ME_TextEditor *editor, ME_DisplayItem **para, ME_DisplayIte } -void ME_SetSelectionParaFormat(ME_TextEditor *editor, const PARAFORMAT2 *pFmt) +BOOL ME_SetSelectionParaFormat(ME_TextEditor *editor, const PARAFORMAT2 *pFmt) { ME_DisplayItem *para, *para_end; @@ -418,6 +420,8 @@ void ME_SetSelectionParaFormat(ME_TextEditor *editor, const PARAFORMAT2 *pFmt) break; para = para->member.para.next_para; } while(1); + + return TRUE; } void ME_GetParaFormat(ME_TextEditor *editor, const ME_DisplayItem *para, PARAFORMAT2 *pFmt) diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index 15cef75..765e8e2 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -1087,6 +1087,27 @@ static void test_EM_SETTEXTMODE(void) DestroyWindow(hwndRichEdit); } +static void test_SETPARAFORMAT(void) +{ + HWND hwndRichEdit = new_richedit(NULL); + PARAFORMAT2 fmt; + HRESULT ret; + fmt.cbSize = sizeof(PARAFORMAT2); + fmt.dwMask = PFM_ALIGNMENT; + fmt.wAlignment = PFA_LEFT; + + ret = SendMessage(hwndRichEdit, EM_SETPARAFORMAT, 0, (LPARAM) &fmt); + ok(ret != 0, "expected non-zero got %d\n", ret); + + fmt.cbSize = sizeof(PARAFORMAT2); + fmt.dwMask = -1; + ret = SendMessage(hwndRichEdit, EM_GETPARAFORMAT, 0, (LPARAM) &fmt); + ok(ret == PFM_ALL2, "expected %x got %x\n", PFM_ALL2, ret); + ok(fmt.dwMask == PFM_ALL2, "expected %x got %x\n", PFM_ALL2, fmt.dwMask); + + DestroyWindow(hwndRichEdit); +} + static void test_TM_PLAINTEXT(void) { /*Tests plain text properties*/ @@ -5396,6 +5417,7 @@ START_TEST( editor ) test_undo_coalescing(); test_word_movement(); test_EM_CHARFROMPOS(); + test_SETPARAFORMAT(); /* Set the environment variable WINETEST_RICHED20 to keep windows * responsive and open for 30 seconds. This is useful for debugging.