[PATCH 1/2] riched20: Implement ITextSelection::GetText. (try 3)

Huw Davies huw at codeweavers.com
Wed Jul 16 06:44:57 CDT 2014

On 15 Jul 2014, at 14:43, Jactry Zeng wrote:
2014-07-15 21:29 GMT+08:00 Huw Davies <huw at codeweavers.com>:
> >
> > Can you at least point to a test that shows this bug?
> Do you mean tests about bug of S/GetSelection?
> It seem is a known bug:
> http://source.winehq.org/git/wine.git/blob/HEAD:/dlls/riched20/tests/editor.c#l4366

Yes.  So adding a special case to SetSelection should fix this.

'to' is already setup correctly to len+1, so the problem is
adjusting cursors[0].  MoveCursorChars is clamping the
cursor to len.

So you have two options, either alter MoveCursorChars
to allow it to move to len + 1. You'd need to retain the current
behaviour in some circumstances though (such as moving
to the right on right-arrow keys press), so you'd need to pass
a flag or something.

Option 2 is just the modify cursor[0] in SetSelection.  If this
is the only place where one can select the final EOP, then
this is probably the preferred solution.

Either way, you probably need to change the 'middle of
end paragraph run' fix up for cursor[0] at the end of
SetSelection (probably by setting nOffset = run.len).

Having done this, check the tests still work (and the
todos are fixed). Also play with wordpad for a while
to see it behaves correctly.

Does that make sense?


More information about the wine-devel mailing list