Commit e1f94386 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

riched20: Set the format of the final eop to be that of the last char.

parent 2dbcddc6
...@@ -1648,7 +1648,17 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre ...@@ -1648,7 +1648,17 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
if (newto > to + (editor->bEmulateVersion10 ? 1 : 0)) { if (newto > to + (editor->bEmulateVersion10 ? 1 : 0)) {
WCHAR lastchar[3] = {'\0', '\0'}; WCHAR lastchar[3] = {'\0', '\0'};
int linebreakSize = editor->bEmulateVersion10 ? 2 : 1; int linebreakSize = editor->bEmulateVersion10 ? 2 : 1;
ME_Cursor linebreakCursor = *selEnd; ME_Cursor linebreakCursor = *selEnd, lastcharCursor = *selEnd;
CHARFORMAT2W cf;
/* Set the final eop to the char fmt of the last char */
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_ALL2;
ME_MoveCursorChars(editor, &lastcharCursor, -1, FALSE);
ME_GetCharFormat(editor, &lastcharCursor, &linebreakCursor, &cf);
ME_SetSelection(editor, newto, -1);
ME_SetSelectionCharFormat(editor, &cf);
ME_SetSelection(editor, newto, newto);
ME_MoveCursorChars(editor, &linebreakCursor, -linebreakSize, FALSE); ME_MoveCursorChars(editor, &linebreakCursor, -linebreakSize, FALSE);
ME_GetTextW(editor, lastchar, 2, &linebreakCursor, linebreakSize, FALSE, FALSE); ME_GetTextW(editor, lastchar, 2, &linebreakCursor, linebreakSize, FALSE, FALSE);
......
...@@ -8372,6 +8372,42 @@ static void test_background(void) ...@@ -8372,6 +8372,42 @@ static void test_background(void)
DestroyWindow(hwndRichEdit); DestroyWindow(hwndRichEdit);
} }
static void test_eop_char_fmt(void)
{
HWND edit = new_richedit( NULL );
const char *rtf = "{\\rtf1{\\fonttbl{\\f0\\fswiss\\fprq2\\fcharset0 Arial;}{\\f1\\fnil\\fcharset2 Symbol;}}"
"{\\fs10{\\pard\\fs16\\fi200\\li360\\f0 First\\par"
"\\f0\\fs25 Second\\par"
"{\\f0\\fs26 Third}\\par"
"{\\f0\\fs22 Fourth}\\par}}}";
EDITSTREAM es;
CHARFORMAT2W cf;
int i, num, expect_height;
es.dwCookie = (DWORD_PTR)&rtf;
es.dwError = 0;
es.pfnCallback = test_EM_STREAMIN_esCallback;
num = SendMessageA( edit, EM_STREAMIN, SF_RTF, (LPARAM)&es );
ok( num == 25, "got %d\n", num );
for (i = 0; i <= num; i++)
{
SendMessageW( edit, EM_SETSEL, i, i + 1 );
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_SIZE;
SendMessageW( edit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf );
ok( cf.dwMask & CFM_SIZE, "%d: got %08x\n", i, cf.dwMask );
if (i < 6) expect_height = 160;
else if (i < 13) expect_height = 250;
else if (i < 18) expect_height = 260;
else if (i == 18 || i == 25) expect_height = 250;
else expect_height = 220;
ok( cf.yHeight == expect_height, "%d: got %d\n", i, cf.yHeight );
}
DestroyWindow( edit );
}
START_TEST( editor ) START_TEST( editor )
{ {
BOOL ret; BOOL ret;
...@@ -8443,6 +8479,7 @@ START_TEST( editor ) ...@@ -8443,6 +8479,7 @@ START_TEST( editor )
test_alignment_style(); test_alignment_style();
test_rtf_specials(); test_rtf_specials();
test_background(); test_background();
test_eop_char_fmt();
/* Set the environment variable WINETEST_RICHED20 to keep windows /* Set the environment variable WINETEST_RICHED20 to keep windows
* responsive and open for 30 seconds. This is useful for debugging. * 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