chop off the unwanted \r from GetLineText() return value for richedit 2.0 controls (patch 1780110)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48627 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1712,9 +1712,16 @@ wxString wxTextCtrl::GetLineText(long lineNo) const
|
|||||||
// should never see it
|
// should never see it
|
||||||
if ( buf[len - 2] == _T('\r') && buf[len - 1] == _T('\n') )
|
if ( buf[len - 2] == _T('\r') && buf[len - 1] == _T('\n') )
|
||||||
{
|
{
|
||||||
|
// richedit 1.0 uses "\r\n" as line terminator, so remove "\r"
|
||||||
|
// here and "\n" below
|
||||||
buf[len - 2] = _T('\n');
|
buf[len - 2] = _T('\n');
|
||||||
len--;
|
len--;
|
||||||
}
|
}
|
||||||
|
else if ( buf[len - 1] == _T('\r') )
|
||||||
|
{
|
||||||
|
// richedit 2.0+ uses only "\r", replace it with "\n"
|
||||||
|
buf[len - 1] = _T('\n');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif // wxUSE_RICHEDIT
|
#endif // wxUSE_RICHEDIT
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user