don't return \r from GetLineText()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23333 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1276,8 +1276,21 @@ wxString wxTextCtrl::GetLineText(long lineNo) const
|
|||||||
wxChar *buf = tmp;
|
wxChar *buf = tmp;
|
||||||
|
|
||||||
*(WORD *)buf = (WORD)len;
|
*(WORD *)buf = (WORD)len;
|
||||||
len = (size_t)::SendMessage(GetHwnd(), EM_GETLINE,
|
len = (size_t)::SendMessage(GetHwnd(), EM_GETLINE, lineNo, (LPARAM)buf);
|
||||||
lineNo, (LPARAM)buf);
|
|
||||||
|
#if wxUSE_RICHEDIT
|
||||||
|
if ( IsRich() )
|
||||||
|
{
|
||||||
|
// remove the '\r' returned by the rich edit control, the user code
|
||||||
|
// should never see it
|
||||||
|
if ( buf[len - 2] == _T('\r') && buf[len - 1] == _T('\n') )
|
||||||
|
{
|
||||||
|
buf[len - 2] = _T('\n');
|
||||||
|
len--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // wxUSE_RICHEDIT
|
||||||
|
|
||||||
buf[len] = 0;
|
buf[len] = 0;
|
||||||
tmp.SetLength(len);
|
tmp.SetLength(len);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user