riched20: do not return incorrect values from ME_CharFromPoint[Cursor]

Thomas Faber thfabba at
Sat Oct 22 15:45:42 CDT 2011

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<len" assertion failure if there is no text in the
The patch fixes riched20 to correctly handle either behavior by
adding a fast path for cx <= 0 (the function obviously needs to return 0 in
the cx == 0 case too, so it can skip the calculation).


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0006-riched20-do-not-return-incorrect-values-from-ME_Char.patch
URL: <>

More information about the wine-patches mailing list