On Thu, Jul 03, 2014 at 04:45:42PM +0800, Jactry Zeng wrote:
index 6f2d579..2553b50 100644 --- a/dlls/riched20/richole.c +++ b/dlls/riched20/richole.c @@ -783,11 +783,31 @@ static HRESULT WINAPI ITextSelection_fnInvoke( static HRESULT WINAPI ITextSelection_fnGetText(ITextSelection *me, BSTR *pbstr) { ITextSelectionImpl *This = impl_from_ITextSelection(me);
- ME_Cursor *start = NULL, *end = NULL;
- int nChars;
- if (!This->reOle) return CO_E_RELEASED;
- TRACE("%p\n", pbstr);
- if (!pbstr)
return E_INVALIDARG;
- FIXME("not implemented\n");
- return E_NOTIMPL;
- ME_GetSelection(This->reOle->editor, &start, &end);
- nChars = ME_GetCursorOfs(end) - ME_GetCursorOfs(start);
- if (!nChars)
- {
*pbstr = NULL;
return S_OK;
- }
- *pbstr = SysAllocStringLen(NULL, nChars);
- if (!*pbstr)
return E_OUTOFMEMORY;
- /* FIXME: a '\r' should be appended at the end of a story */
- ME_GetTextW(This->reOle->editor, *pbstr, nChars, start, nChars, 0);
Actually, perhaps you could fix the FIXME. GetTextW already has the ability to add \r\n, so extending this to add just \r shouldn't be too difficult.
Also, in the tests, you leak the BSTRs.
Huw.