Changed BTextView::GetText(), so that the real work is done by the backend. Should be much faster now.
Fixed _BTextGapBuffer_::RealCharAt(), some minor changes git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8408 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1230,7 +1230,8 @@ BTextView::TextLength() const
|
||||
CALLED();
|
||||
return fText->Length();
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void
|
||||
BTextView::GetText(int32 offset, int32 length, char *buffer) const
|
||||
{
|
||||
@@ -1238,16 +1239,7 @@ BTextView::GetText(int32 offset, int32 length, char *buffer) const
|
||||
if (buffer == NULL)
|
||||
return;
|
||||
|
||||
int32 textLen = fText->Length();
|
||||
if (offset < 0 || offset > (textLen - 1)) {
|
||||
buffer[0] = '\0';
|
||||
return;
|
||||
}
|
||||
|
||||
length = ((offset + length) > textLen) ? textLen - offset : length;
|
||||
for (int32 i = 0; i < length; i++)
|
||||
buffer[i] = (*fText)[i + offset];
|
||||
buffer[length] = '\0';
|
||||
fText->GetString(offset, length, buffer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user