fix off by 1 error in GetTextRaw() (#4317)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54231 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -3691,9 +3691,9 @@ void wxStyledTextCtrl::SetTextRaw(const char* text)
|
|||||||
|
|
||||||
wxCharBuffer wxStyledTextCtrl::GetTextRaw()
|
wxCharBuffer wxStyledTextCtrl::GetTextRaw()
|
||||||
{
|
{
|
||||||
int len = GetTextLength();
|
int len = GetTextLength();
|
||||||
wxCharBuffer buf(len);
|
wxCharBuffer buf(len); // adds 1 for NUL automatically
|
||||||
SendMsg(SCI_GETTEXT, len, (long)buf.data());
|
SendMsg(SCI_GETTEXT, len + 1, (long)buf.data());
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -694,9 +694,9 @@ void wxStyledTextCtrl::SetTextRaw(const char* text)
|
|||||||
|
|
||||||
wxCharBuffer wxStyledTextCtrl::GetTextRaw()
|
wxCharBuffer wxStyledTextCtrl::GetTextRaw()
|
||||||
{
|
{
|
||||||
int len = GetTextLength();
|
int len = GetTextLength();
|
||||||
wxCharBuffer buf(len);
|
wxCharBuffer buf(len); // adds 1 for NUL automatically
|
||||||
SendMsg(SCI_GETTEXT, len, (long)buf.data());
|
SendMsg(SCI_GETTEXT, len + 1, (long)buf.data());
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user