[RICHED20]
authorThomas Faber <thomas.faber@reactos.org>
Sat, 22 Oct 2011 20:55:11 +0000 (20:55 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Sat, 22 Oct 2011 20:55:11 +0000 (20:55 +0000)
- Fix ME_CharFromPoint relying on Wine's incorrect behavior of GetTextExtentExPointW. Already sent upstream(TM)
See issue #6196,5784,6037,6095,6187,6513 for more details.

svn path=/trunk/; revision=54234

reactos/dll/win32/riched20/run.c

index cd282ec..da5553b 100644 (file)
@@ -440,7 +440,7 @@ int ME_CharFromPoint(ME_Context *c, int cx, ME_Run *run)
   int fit = 0;
   HGDIOBJ hOldFont;
   SIZE sz;
   int fit = 0;
   HGDIOBJ hOldFont;
   SIZE sz;
-  if (!run->strText->nLen)
+  if (!run->strText->nLen || cx <= 0)
     return 0;
 
   if (run->nFlags & MERF_TAB ||
     return 0;
 
   if (run->nFlags & MERF_TAB ||
@@ -498,7 +498,7 @@ int ME_CharFromPointCursor(ME_TextEditor *editor, int cx, ME_Run *run)
   ME_Context c;
   HGDIOBJ hOldFont;
   SIZE sz, sz2, sz3;
   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))
     return 0;
 
   if (run->nFlags & (MERF_TAB | MERF_ENDCELL))