diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index 1780bc074e..4a3ec8cd40 100644 --- a/dlls/riched20/caret.c +++ b/dlls/riched20/caret.c @@ -1177,16 +1177,10 @@ void ME_MouseMove(ME_TextEditor *editor, int x, int y) memcmp(&editor->pCursors[1], &editor->pCursors[3], sizeof(ME_Cursor))) { /* The scroll the cursor towards the other end, since it was the one - * extended by ME_ExtendAnchorSelection - */ - ME_Cursor tmpCursor = editor->pCursors[0]; - editor->pCursors[0] = editor->pCursors[1]; - editor->pCursors[1] = tmpCursor; - SendMessageW(editor->hWnd, EM_SCROLLCARET, 0, 0); - editor->pCursors[1] = editor->pCursors[0]; - editor->pCursors[0] = tmpCursor; + * extended by ME_ExtendAnchorSelection */ + ME_EnsureVisible(editor, editor->pCursors[1].pRun); } else { - SendMessageW(editor->hWnd, EM_SCROLLCARET, 0, 0); + ME_EnsureVisible(editor, editor->pCursors[0].pRun); } ME_InvalidateSelection(editor); diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 33310a135c..49f5740ef7 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -3064,23 +3064,8 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, return len; } case EM_SCROLLCARET: - { - int top, bottom; /* row's edges relative to document top */ - int nPos; - ME_DisplayItem *para, *row; - - nPos = ME_GetYScrollPos(editor); - row = ME_RowStart(editor->pCursors[0].pRun); - para = ME_GetParagraph(row); - top = para->member.para.pt.y + row->member.row.pt.y; - bottom = top + row->member.row.nHeight; - - if (top < nPos) /* caret above window */ - ME_ScrollAbs(editor, top); - else if (nPos + editor->sizeWindow.cy < bottom) /*below*/ - ME_ScrollAbs(editor, bottom - editor->sizeWindow.cy); + ME_EnsureVisible(editor, editor->pCursors[0].pRun); return 0; - } case WM_SETFONT: { LOGFONTW lf;