Commit c8a4bb8f authored by Lei Zhang's avatar Lei Zhang Committed by Alexandre Julliard

user32: Fix WM_CHAR return value for edit controls.

parent 42d32aba
......@@ -257,7 +257,7 @@ static BOOL EDIT_EM_Undo(EDITSTATE *es);
/*
* WM_XXX message handlers
*/
static void EDIT_WM_Char(EDITSTATE *es, WCHAR c);
static LRESULT EDIT_WM_Char(EDITSTATE *es, WCHAR c);
static void EDIT_WM_Command(EDITSTATE *es, INT code, INT id, HWND conrtol);
static void EDIT_WM_ContextMenu(EDITSTATE *es, INT x, INT y);
static void EDIT_WM_Copy(EDITSTATE *es);
......@@ -834,7 +834,7 @@ static LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg,
strng[1] = wParam & 0xff;
if (strng[0]) MultiByteToWideChar(CP_ACP, 0, strng, 2, &charW, 1);
else MultiByteToWideChar(CP_ACP, 0, &strng[1], 1, &charW, 1);
EDIT_WM_Char(es, charW);
result = EDIT_WM_Char(es, charW);
break;
}
/* fall through */
......@@ -866,7 +866,7 @@ static LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg,
if (charW == VK_TAB || charW == VK_RETURN)
break;
}
EDIT_WM_Char(es, charW);
result = EDIT_WM_Char(es, charW);
break;
}
......@@ -3994,7 +3994,7 @@ static BOOL EDIT_EM_Undo(EDITSTATE *es)
* WM_CHAR
*
*/
static void EDIT_WM_Char(EDITSTATE *es, WCHAR c)
static LRESULT EDIT_WM_Char(EDITSTATE *es, WCHAR c)
{
BOOL control;
......@@ -4065,6 +4065,7 @@ static void EDIT_WM_Char(EDITSTATE *es, WCHAR c)
}
break;
}
return 1;
}
......
......@@ -731,6 +731,7 @@ static void test_edit_control_2(void)
{
HWND hwndMain;
char szLocalString[MAXLEN];
LONG r;
/* Create main and edit windows. */
hwndMain = CreateWindow(szEditTest2Class, "ET2", WS_OVERLAPPEDWINDOW,
......@@ -749,9 +750,12 @@ static void test_edit_control_2(void)
trace("EDIT: SETTEXT atomicity\n");
/* Send messages to "type" in the word 'foo'. */
SendMessage(hwndET2, WM_CHAR, 'f', 1);
SendMessage(hwndET2, WM_CHAR, 'o', 1);
SendMessage(hwndET2, WM_CHAR, 'o', 1);
r = SendMessage(hwndET2, WM_CHAR, 'f', 1);
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
r = SendMessage(hwndET2, WM_CHAR, 'o', 1);
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
r = SendMessage(hwndET2, WM_CHAR, 'o', 1);
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
/* 'foo' should have been changed to 'bar' by the UPDATE handler. */
GetWindowText(hwndET2, szLocalString, MAXLEN);
ok(lstrcmp(szLocalString, "bar")==0,
......@@ -1553,7 +1557,8 @@ static void test_espassword(void)
/* select all, cut (ctrl-x) */
SendMessage(hwEdit, EM_SETSEL, 0, -1);
SendMessage(hwEdit, WM_CHAR, 24, 0);
r = SendMessage(hwEdit, WM_CHAR, 24, 0);
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
/* get text */
r = SendMessage(hwEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
......@@ -1569,8 +1574,10 @@ static void test_espassword(void)
/* select all, copy (ctrl-c) and paste (ctrl-v) */
SendMessage(hwEdit, EM_SETSEL, 0, -1);
SendMessage(hwEdit, WM_CHAR, 3, 0);
SendMessage(hwEdit, WM_CHAR, 22, 0);
r = SendMessage(hwEdit, WM_CHAR, 3, 0);
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
r = SendMessage(hwEdit, WM_CHAR, 22, 0);
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
/* get text */
buffer[0] = 0;
......@@ -1607,7 +1614,7 @@ static void test_undo(void)
/* cut (ctrl-x) */
r = SendMessage(hwEdit, WM_CHAR, 24, 0);
todo_wine { ok(1 == r, "Expected: %d, got: %d\n", 1, r); }
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
/* get text */
buffer[0] = 0;
......@@ -1617,7 +1624,7 @@ static void test_undo(void)
/* undo (ctrl-z) */
r = SendMessage(hwEdit, WM_CHAR, 26, 0);
todo_wine { ok(1 == r, "Expected: %d, got: %d\n", 1, r); }
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
/* get text */
buffer[0] = 0;
......@@ -1627,7 +1634,7 @@ static void test_undo(void)
/* undo again (ctrl-z) */
r = SendMessage(hwEdit, WM_CHAR, 26, 0);
todo_wine { ok(1 == r, "Expected: %d, got: %d\n", 1, r); }
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
/* get text */
buffer[0] = 0;
......
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