riched20: Don't set para unless committing cursor move in ME_MoveCursorWords.

Introduce a temporary variable, `other_para`, so that we don't end up
returning incorrect para (with stale run) inside the output cursor.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54564
This commit is contained in:
Jinoh Kang 2023-02-25 02:14:36 +09:00 committed by Alexandre Julliard
parent 21d25b17c2
commit 7e28fa5c55
2 changed files with 7 additions and 7 deletions

View file

@ -802,15 +802,18 @@ ME_MoveCursorWords(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs)
}
else
{
para = para_next( para );
if (!para_next( para ))
ME_Paragraph *other_para = para_next( para );
if (!para_next( other_para ))
{
if (cursor->run == run) return FALSE;
nOffset = 0;
break;
}
if (para->nFlags & MEPF_ROWSTART) para = para_next( para );
if (cursor->run == run) run = para_first_run( para );
if (other_para->nFlags & MEPF_ROWSTART) other_para = para_next( other_para );
if (cursor->run == run) {
para = other_para;
run = para_first_run( para );
}
nOffset = 0;
break;
}

View file

@ -7348,7 +7348,6 @@ static void test_word_movement_multiline(void)
sel_start = sel_end = 0xdeadbeefUL;
SendMessageA(hwnd, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end);
ok(sel_start == sel_end, "expected sel length to be 0, got %lu.\n", sel_end - sel_start);
todo_wine
ok(sel_start == 11, "expected sel_start to be %u, got %lu.\n", 11, sel_start);
send_ctrl_key(hwnd, VK_RIGHT);
@ -7356,7 +7355,6 @@ static void test_word_movement_multiline(void)
sel_start = sel_end = 0xdeadbeefUL;
SendMessageA(hwnd, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end);
ok(sel_start == sel_end, "expected sel length to be 0, got %lu.\n", sel_end - sel_start);
todo_wine
ok(sel_start == 12, "expected sel_start to be %u, got %lu.\n", 12, sel_start);
send_ctrl_key(hwnd, VK_LEFT);
@ -7364,7 +7362,6 @@ static void test_word_movement_multiline(void)
sel_start = sel_end = 0xdeadbeefUL;
SendMessageA(hwnd, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end);
ok(sel_start == sel_end, "expected sel length to be 0, got %lu.\n", sel_end - sel_start);
todo_wine
ok(sel_start == 11, "expected sel_start to be %u, got %lu.\n", 11, sel_start);
DestroyWindow(hwnd);