<div dir="ltr">Hi Huw,<div><br></div><div>diTextEnd is useful for append a '\r' to the last paragraph.</div><div>But because of bug of EM_SETSEL or EM_GETSEL, this feature</div><div>still cannot be implemented completely.</div>



<div>For example:</div><div>When the text in Rich Edit control is: "TestSomeText"</div><div>                                                       01234567890123</div><div>We cannot distinguish between SendMessageA(w, EM_SETSEL, 0, 12) and SendMessageA(w, EM_SETSEL, 0, 13).</div>



<div>Attachment is the patch, I just added wine_todo for failed tests cause by this bug.</div><div>But I still have no idea about fixing this bug. Could you give me some suggestion?</div><div>Or just mark them as todo now is OK?</div>


<div><br></div><div>Thank you!</div>















<div class="gmail_extra"><br><br><div class="gmail_quote">2014-07-07 16:38 GMT+08:00 Huw Davies <span dir="ltr"><<a href="mailto:huw@codeweavers.com" target="_blank">huw@codeweavers.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div><div>On Fri, Jul 04, 2014 at 07:00:16PM +0800, Jactry Zeng wrote:<br>
> A few weeks ago, I have made some tests about this problem. And it seem is an<br>
> unimplement feature of Rich edit control and should not be fixed in ME_GetTextW<br>
> or ITextSeletction::GetText simply:<br>
><br>
> 1. end-of-story is different from end-of-paragraph<br>
> From document of ITextDocument::GetStoryCount: Rich edit controls have only one<br>
> story.[1]<br>
> So ‘story’ may is an unit like 'paragraph' in Rich edit control. We may need<br>
> add a MERF_ENDSTORY to implement it.[2]<br>
><br>
> 2. What does the end-of-story looks like?<br>
> When we run the wordpad with native riched20, we can use ‘ctrl + shitf + →’ to<br>
> select the ‘space’ at the end of the Rich edit control. But we cannot set the<br>
> cursor behind it.(a picture here[3])<br>
> And wine’s riched20 didn’t implement this ‘space’. This 'space' may is the end-<br>
> of-story.<br>
><br>
> A crash will happen when we copy the ‘space’ from a native Rich edit control to<br>
> a builtin one.(backtrace.txt[4])<br>
><br>
> BTW, there is a know bug of EM_SETSEL: cannot select the last character of Rich<br>
> edit control.[5]<br>
><br>
> 3.<br>
> From the last paragraph of this blog: <a href="http://blogs.msdn.com/b/murrays/archive/" target="_blank">http://blogs.msdn.com/b/murrays/archive/</a><br>
> 2008/11/22/paragraphs-and-paragraph-formatting.aspx<br>
> It is sure there is a final EOP in a Rich edit control.<br>
><br>
> There seems to be every indication that we should implement the final EOP of<br>
> Rich edit control rather than just append a ‘\r’ in ITextSelection::GetText.<br>
> So I just let a FIXME comment there. I am not sure if I am right. <br>
> Do you have any suggestion?<br>
<br>
</div></div>Well first of all, if there are bugs with the underlying richedit,<br>
these need fixing first.  Note, that every richedit consists of at<br>
least one paragraph (and hence one final EOP).<br>
<br>
I was suggesting adding to ME_GetTextW the ability to append a '\r' if it<br>
were passed an appropriate flag, of course this wouldn't be the behaviour<br>
used for its current callers.  There's already a diTextEnd item in the<br>
display list to mark the end of the document, so there should be no<br>
need to add a new end-of-story marker.  Most of the iterator functions<br>
stop when this is reached, so you tend not to actually see it, but<br>
that shouldn't be a problem.<br>
<span><font color="#888888"><br>
Huw.<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div>Regards,<br></div><div>Jactry Zeng</div><div><br></div></div>
</div></div>