Fix with permission from ROS Jira
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47305 Signed-off-by: Fabian Maurer dark.shadow4@web.de --- dlls/user32/edit.c | 2 +- dlls/user32/tests/edit.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c index 3c5331f9dc..6c758c3911 100644 --- a/dlls/user32/edit.c +++ b/dlls/user32/edit.c @@ -1102,7 +1102,7 @@ static LRESULT EDIT_EM_PosFromChar(EDITSTATE *es, INT index, BOOL after_wrap) x -= es->x_offset; } else - x = es->x_offset; + x = (lw > 0 ? es->x_offset : -es->x_offset);
if (es->style & ES_RIGHT) x = w - (lw - x); diff --git a/dlls/user32/tests/edit.c b/dlls/user32/tests/edit.c index d0374c02a3..31f20fbc12 100644 --- a/dlls/user32/tests/edit.c +++ b/dlls/user32/tests/edit.c @@ -1142,6 +1142,9 @@ static void test_edit_control_4(void) int lo, hi, mid; int ret; int i; + HDC dc; + SIZE size; + RECT rect;
trace("EDIT: Test EM_CHARFROMPOS and EM_POSFROMCHAR\n"); hwEdit = create_editcontrol(ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0); @@ -1251,6 +1254,22 @@ static void test_edit_control_4(void) ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0); ok(-1 == ret, "expected -1 got %d\n", ret); DestroyWindow(hwEdit); + + /* Test newline when the edit control is scrolled to the right */ + + hwEdit = create_editcontrol(ES_MULTILINE | ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0); + SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM)"wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\r\n\r\n"); + SendMessageA(hwEdit, EM_SETSEL, 40, 40); + + dc = GetDC(hwEdit); + GetClientRect(hwEdit, &rect); + GetTextExtentPoint32A(dc, "w", 1, &size); + ReleaseDC(hwEdit, dc); + lo = (short)LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 42, 0)); + ret = (short)LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 40, 0)); + ret = size.cx * (-40) + ret; + ok(ret == lo, "expected %d got %d\n", ret, lo); + DestroyWindow(hwEdit); }
/* Test if creating edit control without ES_AUTOHSCROLL and ES_AUTOVSCROLL -- 2.21.0
Fix with permission from ROS Jira
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47305 Signed-off-by: Fabian Maurer dark.shadow4@web.de --- dlls/comctl32/edit.c | 2 +- dlls/comctl32/tests/edit.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/dlls/comctl32/edit.c b/dlls/comctl32/edit.c index e64e260bd7..6d8c07273c 100644 --- a/dlls/comctl32/edit.c +++ b/dlls/comctl32/edit.c @@ -1043,7 +1043,7 @@ static LRESULT EDIT_EM_PosFromChar(EDITSTATE *es, INT index, BOOL after_wrap) x -= es->x_offset; } else - x = es->x_offset; + x = (lw > 0 ? es->x_offset : -es->x_offset);
if (es->style & ES_RIGHT) x = w - (lw - x); diff --git a/dlls/comctl32/tests/edit.c b/dlls/comctl32/tests/edit.c index f454434a0c..f1dc974eaa 100644 --- a/dlls/comctl32/tests/edit.c +++ b/dlls/comctl32/tests/edit.c @@ -1189,6 +1189,9 @@ static void test_char_from_pos(void) { int lo, hi, mid, ret, i; HWND hwEdit; + HDC dc; + SIZE size; + RECT rect;
hwEdit = create_editcontrol(ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0); SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM)"aa"); @@ -1321,6 +1324,22 @@ static void test_char_from_pos(void) ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0); ok(-1 == ret, "expected -1 got %d\n", ret); DestroyWindow(hwEdit); + + /* Test newline when the edit control is scrolled to the right */ + + hwEdit = create_editcontrol(ES_MULTILINE | ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0); + SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM)"wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\r\n\r\n"); + SendMessageA(hwEdit, EM_SETSEL, 40, 40); + + dc = GetDC(hwEdit); + GetClientRect(hwEdit, &rect); + GetTextExtentPoint32A(dc, "w", 1, &size); + ReleaseDC(hwEdit, dc); + lo = (short)LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 42, 0)); + ret = (short)LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 40, 0)); + ret = size.cx * (-40) + ret; + ok(ret == lo, "expected %d got %d\n", ret, lo); + DestroyWindow(hwEdit); }
/* Test if creating edit control without ES_AUTOHSCROLL and ES_AUTOVSCROLL -- 2.21.0
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=53148
Your paranoid android.
=== debian9 (32 bit WoW report) ===
user32: msg.c:8713: Test failed: WaitForSingleObject failed 102 msg.c:8719: Test failed: destroy child on thread exit: 0: the msg 0x0082 was expected, but got msg 0x000f instead msg.c:8719: Test failed: destroy child on thread exit: 1: the msg 0x000f was expected, but got msg 0x0014 instead msg.c:8719: Test failed: destroy child on thread exit: 2: the msg sequence is not complete: expected 0014 - actual 0000 win.c:10127: Test failed: Expected foreground window 0, got 00E300D4 win.c:10133: Test failed: Expected foreground window 00130120, got 00E300D4
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=53147
Your paranoid android.
=== debian9 (32 bit Chinese:China report) ===
user32: msg.c:8713: Test failed: WaitForSingleObject failed 102 msg.c:8719: Test failed: destroy child on thread exit: 0: the msg 0x0082 was expected, but got msg 0x000f instead msg.c:8719: Test failed: destroy child on thread exit: 1: the msg 0x000f was expected, but got msg 0x0014 instead msg.c:8719: Test failed: destroy child on thread exit: 2: the msg sequence is not complete: expected 0014 - actual 0000
Any news on this patchset?
Regards, Fabian Maurer
On Thu, Jul 4, 2019 at 7:46 PM Fabian Maurer dark.shadow4@web.de wrote:
Any news on this patchset?
@@ -1102,7 +1102,7 @@ static LRESULT EDIT_EM_PosFromChar(EDITSTATE *es, INT index, BOOL after_wrap) x -= es->x_offset; } else - x = es->x_offset; + x = (lw > 0 ? es->x_offset : -es->x_offset);
if (es->style & ES_RIGHT) x = w - (lw - x);
How to trigger this alternate path which is !ssa && lw > 0? In other words, do we have tests for both cases of that else branch.
Regards, Fabian Maurer