Re: [PATCH 1/2] riched20: Implement ITextSelection::GetText.
+HRESULT ME_ITextGetText(ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, BSTR *pb) DECLSPEC_HIDDEN; Is this really needed? + buffer = heap_alloc((nChars + 1) * sizeof(WCHAR)); + if (!buffer) + return E_OUTOFMEMORY; + ME_GetTextW(editor, buffer, nChars, start, nChars, 0); + buffer[nChars] = 0; + /* FIXME: a '\r' should be appended at the end of a story */ + *pb = SysAllocString(buffer); + heap_free(buffer); This could be simplified with SysAllocStringLen().
Hi Nikolay, 2014-05-21 14:56 GMT+08:00 Nikolay Sivov <bunglehead(a)gmail.com>:
+HRESULT ME_ITextGetText(ME_TextEditor *editor, ME_Cursor *start,
ME_Cursor *end, BSTR *pb) DECLSPEC_HIDDEN;
Is this really needed?
I would like to share ME_ITextGetText between ITextSelection::GetText and ITextRange::GetText. Thanks for your review! -- Regards, Jactry Zeng
On 5/21/2014 12:20, Jactry Zeng wrote:
Hi Nikolay, 2014-05-21 14:56 GMT+08:00 Nikolay Sivov <bunglehead(a)gmail.com <mailto:bunglehead(a)gmail.com>>:
+HRESULT ME_ITextGetText(ME_TextEditor *editor, ME_Cursor *start,
ME_Cursor *end, BSTR *pb) DECLSPEC_HIDDEN;
Is this really needed?
I would like to share ME_ITextGetText between ITextSelection::GetText and ITextRange::GetText. But ITextSelection is a ITextRange too, so you need to implement it for ITextRange only.
Thanks for your review! -- Regards, Jactry Zeng
2014-05-21 16:26 GMT+08:00 Nikolay Sivov <bunglehead(a)gmail.com>:
But ITextSelection is a ITextRange too, so you need to implement it for
ITextRange only. Yes, ITextSelection interface is inherits from ITextRange. But I think functions of ITextRange and functions of ITextSelection are independent of each other. And there are some different between them: range of an ITextRange is given by ITextDocument::Range and immovable but range of ITextSelection of is depend on *pCursor in ME_TextEditor. So I think implementing ITextSelection independently and just share some functions like ME_ITextGetText between ITextRange and ITextSelection is a more convenient way. -- Regards, Jactry Zeng
participants (2)
-
Jactry Zeng -
Nikolay Sivov