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

riched20: WM_GETTEXTLENGTH should include CRLF conversions in returned count.

parent 3b636b58
......@@ -1996,7 +1996,13 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
return 0;
}
case WM_GETTEXTLENGTH:
return ME_GetTextLength(editor);
{
GETTEXTLENGTHEX how;
how.flags = GTL_CLOSE | GTL_USECRLF | GTL_NUMCHARS;
how.codepage = unicode ? 1200 : CP_ACP;
return ME_GetTextLengthEx(editor, &how);
}
case EM_GETTEXTLENGTHEX:
return ME_GetTextLengthEx(editor, (GETTEXTLENGTHEX *)wParam);
case WM_GETTEXT:
......
......@@ -671,6 +671,12 @@ static void test_WM_GETTEXT(void)
ok(result == 0,
"WM_GETTEXT: settext and gettext differ. strcmp: %d\n", result);
/* Test for returned value of WM_GETTEXTLENGTH */
result = SendMessage(hwndRichEdit, WM_GETTEXTLENGTH, 0, 0);
ok(result == strlen(text),
"WM_GETTEXTLENGTH reports incorrect length %d, expected %d\n",
result, strlen(text));
/* Test for behavior in overflow case */
memset(buffer, 0, 1024);
result = SendMessage(hwndRichEdit, WM_GETTEXT, strlen(text), (LPARAM)buffer);
......@@ -689,6 +695,12 @@ static void test_WM_GETTEXT(void)
ok(result == 0,
"WM_GETTEXT: settext and gettext differ. strcmp: %d\n", result);
/* Test for returned value of WM_GETTEXTLENGTH */
result = SendMessage(hwndRichEdit, WM_GETTEXTLENGTH, 0, 0);
ok(result == strlen(text2_after),
"WM_GETTEXTLENGTH reports incorrect length %d, expected %d\n",
result, strlen(text2_after));
/* Test for behavior of CRLF conversion in case of overflow */
memset(buffer, 0, 1024);
result = SendMessage(hwndRichEdit, WM_GETTEXT, strlen(text2), (LPARAM)buffer);
......
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