riched32: Handle enter press in WM_CHAR instead of WM_KEYDOWN.
This fixes an old regression when VK_RETURN handling was implemented Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=23282 Signed-off-by: Fabian Maurer <dark.shadow4@web.de> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c03c5397a2
commit
52c106418c
|
@ -2668,7 +2668,9 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
|
|||
ME_SendRequestResize(editor, FALSE);
|
||||
return TRUE;
|
||||
case VK_RETURN:
|
||||
return handle_enter(editor);
|
||||
if (!editor->bEmulateVersion10)
|
||||
return handle_enter(editor);
|
||||
break;
|
||||
case VK_ESCAPE:
|
||||
if (editor->bDialogMode && editor->hwndParent)
|
||||
PostMessageW(editor->hwndParent, WM_CLOSE, 0, 0);
|
||||
|
@ -2740,6 +2742,12 @@ static LRESULT ME_Char(ME_TextEditor *editor, WPARAM charCode,
|
|||
if (editor->bMouseCaptured)
|
||||
return 0;
|
||||
|
||||
if (editor->styleFlags & ES_READONLY)
|
||||
{
|
||||
MessageBeep(MB_ICONERROR);
|
||||
return 0; /* FIXME really 0 ? */
|
||||
}
|
||||
|
||||
if (unicode)
|
||||
wstr = (WCHAR)charCode;
|
||||
else
|
||||
|
@ -2748,10 +2756,8 @@ static LRESULT ME_Char(ME_TextEditor *editor, WPARAM charCode,
|
|||
MultiByteToWideChar(CP_ACP, 0, &charA, 1, &wstr, 1);
|
||||
}
|
||||
|
||||
if (editor->styleFlags & ES_READONLY) {
|
||||
MessageBeep(MB_ICONERROR);
|
||||
return 0; /* FIXME really 0 ? */
|
||||
}
|
||||
if (editor->bEmulateVersion10 && wstr == '\r')
|
||||
handle_enter(editor);
|
||||
|
||||
if ((unsigned)wstr >= ' ' || wstr == '\t')
|
||||
{
|
||||
|
|
|
@ -8273,6 +8273,7 @@ static void format_test_result(char *target, const char *src)
|
|||
* inserts CR. If shows that EM_GETTEXTEX with GT_USECRLF == WM_GETTEXT
|
||||
* and also shows that GT_USECRLF has no effect in richedit 1.0, but
|
||||
* does for higher. The same test is cloned in riched32 and riched20.
|
||||
* Also shows the difference between WM_CHAR/WM_KEYDOWN in v1.0 and higher versions
|
||||
*/
|
||||
static void test_enter(void)
|
||||
{
|
||||
|
@ -8353,6 +8354,34 @@ static void test_enter(void)
|
|||
i, resultbuf, expectedbuf);
|
||||
}
|
||||
|
||||
/* Show that WM_CHAR is handled differently from WM_KEYDOWN */
|
||||
getText.flags = GT_DEFAULT;
|
||||
getText.codepage = CP_ACP;
|
||||
|
||||
result = SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"");
|
||||
ok (result == 1, "[%d] WM_SETTEXT returned %ld instead of 1\n", i, result);
|
||||
SendMessageW(hwndRichEdit, WM_CHAR, 'T', 0);
|
||||
SendMessageW(hwndRichEdit, WM_KEYDOWN, VK_RETURN, 0);
|
||||
|
||||
result = SendMessageA(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM)buf);
|
||||
ok(result == 2, "Got %d\n", (int)result);
|
||||
format_test_result(resultbuf, buf);
|
||||
format_test_result(expectedbuf, "T\r");
|
||||
result = strcmp(resultbuf, expectedbuf);
|
||||
ok (result == 0, "[%d] EM_GETTEXTEX, GT_DEFAULT unexpected '%s', expected '%s'\n", i, resultbuf, expectedbuf);
|
||||
|
||||
result = SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"");
|
||||
ok (result == 1, "[%d] WM_SETTEXT returned %ld instead of 1\n", i, result);
|
||||
SendMessageW(hwndRichEdit, WM_CHAR, 'T', 0);
|
||||
SendMessageW(hwndRichEdit, WM_CHAR, '\r', 0);
|
||||
|
||||
result = SendMessageA(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM)buf);
|
||||
ok(result == 1, "Got %d\n", (int)result);
|
||||
format_test_result(resultbuf, buf);
|
||||
format_test_result(expectedbuf, "T");
|
||||
result = strcmp(resultbuf, expectedbuf);
|
||||
ok (result == 0, "[%d] EM_GETTEXTEX, GT_DEFAULT unexpected '%s', expected '%s'\n", i, resultbuf, expectedbuf);
|
||||
|
||||
DestroyWindow(hwndRichEdit);
|
||||
}
|
||||
|
||||
|
|
|
@ -1163,6 +1163,7 @@ static void format_test_result(char *target, const char *src)
|
|||
* inserts CR. If shows that EM_GETTEXTEX with GT_USECRLF == WM_GETTEXT
|
||||
* and also shows that GT_USECRLF has no effect in richedit 1.0, but
|
||||
* does for higher. The same test is cloned in riched32 and riched20.
|
||||
* Also shows the difference between WM_CHAR/WM_KEYDOWN in v1.0 and higher versions
|
||||
*/
|
||||
static void test_enter(void)
|
||||
{
|
||||
|
@ -1241,6 +1242,34 @@ static void test_enter(void)
|
|||
i, resultbuf, expectedbuf);
|
||||
}
|
||||
|
||||
/* Show that WM_CHAR is handled differently from WM_KEYDOWN */
|
||||
getText.flags = GT_DEFAULT;
|
||||
getText.codepage = CP_ACP;
|
||||
|
||||
result = SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"");
|
||||
ok (result == 1, "[%d] WM_SETTEXT returned %ld instead of 1\n", i, result);
|
||||
SendMessageW(hwndRichEdit, WM_CHAR, 'T', 0);
|
||||
SendMessageW(hwndRichEdit, WM_KEYDOWN, VK_RETURN, 0);
|
||||
|
||||
result = SendMessageA(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM)buf);
|
||||
ok(result == 1, "Got %d\n", (int)result);
|
||||
format_test_result(resultbuf, buf);
|
||||
format_test_result(expectedbuf, "T");
|
||||
result = strcmp(resultbuf, expectedbuf);
|
||||
ok (result == 0, "[%d] EM_GETTEXTEX, GT_DEFAULT unexpected '%s', expected '%s'\n", i, resultbuf, expectedbuf);
|
||||
|
||||
result = SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"");
|
||||
ok (result == 1, "[%d] WM_SETTEXT returned %ld instead of 1\n", i, result);
|
||||
SendMessageW(hwndRichEdit, WM_CHAR, 'T', 0);
|
||||
SendMessageW(hwndRichEdit, WM_CHAR, '\r', 0);
|
||||
|
||||
SendMessageA(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM)buf);
|
||||
ok(result == 1, "Got %d\n", (int)result);
|
||||
format_test_result(resultbuf, buf);
|
||||
format_test_result(expectedbuf, "T\r\n");
|
||||
result = strcmp(resultbuf, expectedbuf);
|
||||
ok (result == 0, "[%d] EM_GETTEXTEX, GT_DEFAULT unexpected '%s', expected '%s'\n", i, resultbuf, expectedbuf);
|
||||
|
||||
DestroyWindow(hwndRichEdit);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue