riched20: Minimal fix for WM_SETTEXT without ES_MULTILINE style.
This commit is contained in:
parent
2055e636ae
commit
63b12f8602
|
@ -1908,8 +1908,18 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
|
|||
TRACE("WM_SETTEXT - %s\n", debugstr_w(wszText)); /* debugstr_w() */
|
||||
if (lstrlenW(wszText) > 0)
|
||||
{
|
||||
int len = -1;
|
||||
|
||||
/* uses default style! */
|
||||
ME_InsertTextFromCursor(editor, 0, wszText, -1, editor->pBuffer->pDefaultStyle);
|
||||
if (!(GetWindowLongW(hWnd, GWL_STYLE) & ES_MULTILINE))
|
||||
{
|
||||
WCHAR * p;
|
||||
|
||||
p = wszText;
|
||||
while (*p != '\0' && *p != '\r' && *p != '\n') p++;
|
||||
len = p - wszText;
|
||||
}
|
||||
ME_InsertTextFromCursor(editor, 0, wszText, len, editor->pBuffer->pDefaultStyle);
|
||||
}
|
||||
ME_EndToUnicode(unicode, wszText);
|
||||
}
|
||||
|
|
|
@ -2064,6 +2064,9 @@ static void test_EM_GETTEXTLENGTHEX(void)
|
|||
HWND hwnd;
|
||||
GETTEXTLENGTHEX gtl;
|
||||
int ret;
|
||||
const char * test_string = "a\nb\n\n\r\n";
|
||||
const char * test_string_after = "a";
|
||||
char buffer[64] = {0};
|
||||
|
||||
/* single line */
|
||||
hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP,
|
||||
|
@ -2080,17 +2083,21 @@ static void test_EM_GETTEXTLENGTHEX(void)
|
|||
ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)>l, 0);
|
||||
ok(ret == 0, "ret %d\n",ret);
|
||||
|
||||
SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) "a\nb\n\n\r\n");
|
||||
SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) test_string);
|
||||
|
||||
gtl.flags = GTL_NUMCHARS | GTL_PRECISE | GTL_USECRLF;
|
||||
gtl.codepage = CP_ACP;
|
||||
ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)>l, 0);
|
||||
todo_wine ok(ret == 1, "ret %d\n",ret);
|
||||
ok(ret == 1, "ret %d\n",ret);
|
||||
|
||||
gtl.flags = GTL_NUMCHARS | GTL_PRECISE;
|
||||
gtl.codepage = CP_ACP;
|
||||
ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)>l, 0);
|
||||
todo_wine ok(ret == 1, "ret %d\n",ret);
|
||||
ok(ret == 1, "ret %d\n",ret);
|
||||
|
||||
SendMessage(hwnd, WM_GETTEXT, sizeof(buffer), (LPARAM)buffer);
|
||||
ret = strcmp(buffer, test_string_after);
|
||||
ok(ret == 0, "WM_GETTEXT recovered incorrect string!\n");
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
|
@ -2109,7 +2116,7 @@ static void test_EM_GETTEXTLENGTHEX(void)
|
|||
ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)>l, 0);
|
||||
ok(ret == 0, "ret %d\n",ret);
|
||||
|
||||
SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) "a\nb\n\n\r\n");
|
||||
SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) test_string);
|
||||
|
||||
gtl.flags = GTL_NUMCHARS | GTL_PRECISE | GTL_USECRLF;
|
||||
gtl.codepage = CP_ACP;
|
||||
|
|
Loading…
Reference in New Issue