diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 180fda9391b..c8de84d4ff1 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -1724,10 +1724,15 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP nCharOfs = lParam; nLength = ME_GetTextLength(editor); - if (nCharOfs < nLength-1) { + if (nCharOfs < nLength) { ME_RunOfsFromCharOfs(editor, nCharOfs, &pRun, &nOffset); + assert(pRun->type == diRun); pt.y = pRun->member.run.pt.y; pt.x = pRun->member.run.pt.x + ME_PointFromChar(editor, &pRun->member.run, nOffset); + pt.y += ME_GetParagraph(pRun)->member.para.nYPos; + } else { + pt.x = 0; + pt.y = editor->pBuffer->pLast->member.para.nYPos; } pt.y += ME_GetParagraph(pRun)->member.para.nYPos; if (wParam >= 0x40000) {