mirror of
https://github.com/reactos/wine.git
synced 2025-02-09 05:36:56 +00:00
richedit: Handle negative position given to EM_POSFROMCHAR.
This commit is contained in:
parent
795c4a77aa
commit
09802e2c76
@ -3544,6 +3544,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
|
|||||||
nCharOfs = lParam;
|
nCharOfs = lParam;
|
||||||
nLength = ME_GetTextLength(editor);
|
nLength = ME_GetTextLength(editor);
|
||||||
nCharOfs = min(nCharOfs, nLength);
|
nCharOfs = min(nCharOfs, nLength);
|
||||||
|
nCharOfs = max(nCharOfs, 0);
|
||||||
|
|
||||||
ME_RunOfsFromCharOfs(editor, nCharOfs, &pRun, &nOffset);
|
ME_RunOfsFromCharOfs(editor, nCharOfs, &pRun, &nOffset);
|
||||||
assert(pRun->type == diRun);
|
assert(pRun->type == diRun);
|
||||||
|
@ -649,6 +649,10 @@ static void test_EM_POSFROMCHAR(void)
|
|||||||
SendMessage(hwndRichEdit, WM_GETTEXTLENGTH, 0, 0)+1);
|
SendMessage(hwndRichEdit, WM_GETTEXTLENGTH, 0, 0)+1);
|
||||||
ok(pt.x == xpos, "pt.x = %d\n", pt.x);
|
ok(pt.x == xpos, "pt.x = %d\n", pt.x);
|
||||||
|
|
||||||
|
/* Try a negative position. */
|
||||||
|
SendMessage(hwndRichEdit, EM_POSFROMCHAR, (WPARAM)&pt, -1);
|
||||||
|
ok(pt.x == 1, "pt.x = %d\n", pt.x);
|
||||||
|
|
||||||
DestroyWindow(hwndRichEdit);
|
DestroyWindow(hwndRichEdit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user