Commit cac55008 authored by Alex Villacís Lasso's avatar Alex Villacís Lasso Committed by Alexandre Julliard

richedit: Implement rule that in 1.0 emulation, a single CR that terminates the…

richedit: Implement rule that in 1.0 emulation, a single CR that terminates the text is NOT a line break. Fix riched32 test that now succeed.
parent 4047df0f
......@@ -2702,12 +2702,30 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
ME_DisplayItem *item = editor->pBuffer->pFirst->next;
int nRows = 0;
ME_DisplayItem *prev_para = NULL, *last_para = NULL;
while (item != editor->pBuffer->pLast)
{
assert(item->type == diParagraph);
prev_para = ME_FindItemBack(item, diRun);
if (prev_para) {
assert(prev_para->member.run.nFlags & MERF_ENDPARA);
}
nRows += item->member.para.nRows;
item = item->member.para.next_para;
}
last_para = ME_FindItemBack(item, diRun);
assert(last_para);
assert(last_para->member.run.nFlags & MERF_ENDPARA);
if (editor->bEmulateVersion10 && prev_para && last_para->member.run.nCharOfs == 0
&& prev_para->member.run.nCR == 1 && prev_para->member.run.nLF == 0)
{
/* In 1.0 emulation, the last solitary \r at the very end of the text
(if one exists) is NOT a line break.
FIXME: this is an ugly hack. This should have a more regular model. */
nRows--;
}
TRACE("EM_GETLINECOUNT: nRows==%d\n", nRows);
return max(1, nRows);
}
......
......@@ -110,8 +110,8 @@ static void test_WM_SETTEXT()
}
TEST_SETTEXT(TestItem1, TestItem1, 1, 0, 0)
TEST_SETTEXT(TestItem2, TestItem2, 1, 0, 1)
TEST_SETTEXT(TestItem3, TestItem3, 2, 0, 1)
TEST_SETTEXT(TestItem2, TestItem2, 1, 0, 0)
TEST_SETTEXT(TestItem3, TestItem3, 2, 0, 0)
TEST_SETTEXT(TestItem4, TestItem4, 3, 0, 0)
TEST_SETTEXT(TestItem5, TestItem5, 2, 0, 0)
TEST_SETTEXT(TestItem6, TestItem6, 3, 0, 0)
......@@ -123,7 +123,7 @@ static void test_WM_SETTEXT()
TEST_SETTEXT(TestItem12, TestItem12, 2, 0, 0)
TEST_SETTEXT(TestItem13, TestItem13, 3, 0, 0)
TEST_SETTEXT(TestItem14, TestItem14, 2, 0, 0)
TEST_SETTEXT(TestItem15, TestItem15, 3, 0, 1)
TEST_SETTEXT(TestItem15, TestItem15, 3, 0, 0)
TEST_SETTEXT(TestItem16, TestItem16, 4, 0, 0)
#undef TEST_SETTEXT
......
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