fix for bug #29 (blank lines in GetLineText)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6272 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-02-25 00:03:29 +00:00
parent 030d06e13f
commit 488fe1feb6

View File

@@ -807,7 +807,16 @@ int wxTextCtrl::GetLineLength(long lineNo) const
wxString wxTextCtrl::GetLineText(long lineNo) const
{
// TODO this should probably be optimized by using GetWriteBuf()
size_t len = (size_t)GetLineLength(lineNo) + 1;
if ( len < sizeof(WORD) )
{
// there must be at least enough place for the length WORD in the
// buffer
len += sizeof(WORD);
}
char *buf = (char *)malloc(len);
*(WORD *)buf = len;
int noChars = (int)SendMessage(GetHwnd(), EM_GETLINE, lineNo, (LPARAM)buf);