From: Santino Mazza mazzasantino1206@gmail.com
Signed-off-by: Santino Mazza mazzasantino1206@gmail.com --- dlls/riched20/tests/editor.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index 03c07829ee4..2667e7d3fdc 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -5018,6 +5018,24 @@ static void check_EM_SETSEL(HWND hwnd, const struct exsetsel_s *setsel, int id) id, setsel->expected_getsel_start, setsel->expected_getsel_end, start, end); }
+/* When the selection is out of the windows view, the scrollbar should move. */ +static void check_EM_SETSEL_multiline(HWND hwnd) +{ + int oldY; + int curY; + const char textwithlines[] = "This is a text\n" + "with lines\n" + "I expect this text\n" + "to be\nlarge\nenough\n"; + + SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)textwithlines); + oldY = get_scroll_pos_y(hwnd); + SendMessageA(hwnd, EM_SETSEL, 59, 59); + curY = get_scroll_pos_y(hwnd); + todo_wine + ok(oldY < curY, "oldY %d >= curY %d\n", oldY, curY); +} + static void test_EM_SETSEL(void) { char buffA[32] = {0}; @@ -5058,6 +5076,8 @@ static void test_EM_SETSEL(void) ok(sel_end == 8, "Selection end incorrectly: %d expected 8\n", sel_end); }
+ check_EM_SETSEL_multiline(hwndRichEdit); + DestroyWindow(hwndRichEdit); }
From: Santino Mazza mazzasantino1206@gmail.com
Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=40444 Signed-off-by: Santino Mazza mazzasantino1206@gmail.com --- dlls/riched20/editor.c | 1 + dlls/riched20/tests/editor.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 108c37a7f30..57601745ab2 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -2142,6 +2142,7 @@ int set_selection( ME_TextEditor *editor, int to, int from )
if (!editor->bHideSelection) ME_InvalidateSelection( editor ); end = set_selection_cursors( editor, to, from ); + editor_ensure_visible( editor, &editor->pCursors[0] ); if (!editor->bHideSelection) ME_InvalidateSelection( editor ); update_caret( editor ); ME_SendSelChange( editor ); diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index 2667e7d3fdc..1661654aa11 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -5032,7 +5032,6 @@ static void check_EM_SETSEL_multiline(HWND hwnd) oldY = get_scroll_pos_y(hwnd); SendMessageA(hwnd, EM_SETSEL, 59, 59); curY = get_scroll_pos_y(hwnd); - todo_wine ok(oldY < curY, "oldY %d >= curY %d\n", oldY, curY); }
It would be good to add similar tests for e.g. `ITextSelection_Select()` (see `test_Select()` in `tests\richole.c`).