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:
Vadim Zeitlin 2003-08-31 21:02:21 +00:00
parent 51a7e6af00
commit 60ab0c52e3

View File

@ -1276,8 +1276,21 @@ wxString wxTextCtrl::GetLineText(long lineNo) const
wxChar *buf = tmp;
*(WORD *)buf = (WORD)len;
len = (size_t)::SendMessage(GetHwnd(), EM_GETLINE,
lineNo, (LPARAM)buf);
len = (size_t)::SendMessage(GetHwnd(), EM_GETLINE, 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;
tmp.SetLength(len);
}