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

richedit: EM_[SG]ETPARAFORMAT returned the wrong value.

The values returned by EM_SETPARAFORMAT and EM_GETPARAFORMAT previously indicated an error, and the included tests shows that Windows behaves as documented.
parent 30cd9b47
......@@ -2728,13 +2728,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;
......
......@@ -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 */
......
......@@ -430,7 +430,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));
......@@ -487,6 +487,8 @@ void ME_SetParaFormat(ME_TextEditor *editor, ME_DisplayItem *para, const PARAFOR
if (memcmp(&copy, para->member.para.pFmt, sizeof(PARAFORMAT2)))
para->member.para.nFlags |= MEPF_REWRAP;
return TRUE;
}
......@@ -514,7 +516,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;
......@@ -526,6 +528,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)
......
......@@ -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.
......
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