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

Thomas Faber thfabba at gmx.de
Sun Oct 23 11:12:01 CDT 2011


Hi,

On 2011-10-22 22:45, Thomas Faber wrote:
> 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
> control.

this description isn't 100% complete (the fix is correct nonetheless). With the
help of the corresponding gdi32 tests [1], I can describe it better:
The nAvailWidth in a zero-width richedit control will be -2 (as borders are
subtracted by the format rect, resulting in an invalid rect, as previously
demonstrated), which will be passed as max_extent to GetTextExtentExPointW.
Wine's version would return 0 as expected, while Windows's would interpret
this as a large unsigned number and return the length of the text (1 in my
test case, mIRC).
This eventually led to the i<len assertion failing, as i was set to len
exactly.

I hope this clears up any doubts.
Wine's riched20 now works nicely as a replacement for its counterpart. :)

Best regards and have a nice Sunday.
Tom


[1] http://www.winehq.org/pipermail/wine-patches/2011-October/108186.html



More information about the wine-devel mailing list