From: Thomas Faber Subject: riched20: do not return incorrect values from ME_CharFromPoint[Cursor] Message-Id: <4EA32B76.3000507@gmx.de> Date: Sat, 22 Oct 2011 22:45:42 +0200 This is the correct fix for the problem I previously described [1]. ME_CharFromPoint is called with cx < 0 if the richedit control has zero or otherwise very small width. Windows's version of GetTextExtentExPointW, which is called in that function, returns a value of 1 in this case (Wine's does not, which would appear to be a bug), leading to the "i Date: Sat, 22 Oct 2011 21:41:28 +0200 Subject: riched20: do not return incorrect values from ME_CharFromPoint[Cursor] --- dlls/riched20/run.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/riched20/run.c b/dlls/riched20/run.c index 4a9ae7a..8a1f91f 100644 --- a/dlls/riched20/run.c +++ b/dlls/riched20/run.c @@ -434,7 +434,7 @@ int ME_CharFromPoint(ME_Context *c, int cx, ME_Run *run) int fit = 0; HGDIOBJ hOldFont; SIZE sz; - if (!run->strText->nLen) + if (!run->strText->nLen || cx <= 0) return 0; if (run->nFlags & MERF_TAB || @@ -492,7 +492,7 @@ int ME_CharFromPointCursor(ME_TextEditor *editor, int cx, ME_Run *run) ME_Context c; HGDIOBJ hOldFont; SIZE sz, sz2, sz3; - if (!run->strText->nLen) + if (!run->strText->nLen || cx <= 0) return 0; if (run->nFlags & (MERF_TAB | MERF_ENDCELL)) -- 1.7.1.GIT