* temporarily removed parts of my last change as this completely ruins
single-lined textviews - needs some more thinking ... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30456 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
4fd7901292
commit
2ae836dbe0
@ -1771,24 +1771,32 @@ BTextView::PointAt(int32 inOffset, float *outHeight) const
|
||||
} else {
|
||||
height = (line + 1)->origin - line->origin;
|
||||
|
||||
int32 offset = line->offset;
|
||||
int32 length = inOffset - line->offset;
|
||||
int32 numBytes = length;
|
||||
bool foundTab = false;
|
||||
do {
|
||||
foundTab = fText->FindChar(B_TAB, offset, &numBytes);
|
||||
float width = _StyledWidth(offset, numBytes);
|
||||
result.x += width;
|
||||
// special case: go down one line if inOffset is a newline
|
||||
if (inOffset == TextLength() && inOffset > 0
|
||||
&& fText->RealCharAt(inOffset - 1) == B_ENTER) {
|
||||
result.y += height;
|
||||
height = LineHeight(CountLines() - 1);
|
||||
|
||||
if (foundTab) {
|
||||
result.x += _ActualTabWidth(result.x);
|
||||
numBytes++;
|
||||
}
|
||||
} else {
|
||||
int32 offset = line->offset;
|
||||
int32 length = inOffset - line->offset;
|
||||
int32 numBytes = length;
|
||||
bool foundTab = false;
|
||||
do {
|
||||
foundTab = fText->FindChar(B_TAB, offset, &numBytes);
|
||||
float width = _StyledWidth(offset, numBytes);
|
||||
result.x += width;
|
||||
|
||||
offset += numBytes;
|
||||
length -= numBytes;
|
||||
numBytes = length;
|
||||
} while (foundTab && length > 0);
|
||||
if (foundTab) {
|
||||
result.x += _ActualTabWidth(result.x);
|
||||
numBytes++;
|
||||
}
|
||||
|
||||
offset += numBytes;
|
||||
length -= numBytes;
|
||||
numBytes = length;
|
||||
} while (foundTab && length > 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (fAlignment != B_ALIGN_LEFT) {
|
||||
|
@ -65,10 +65,6 @@ BTextView::LineBuffer::OffsetToLine(int32 offset) const
|
||||
maxIndex = index;
|
||||
}
|
||||
|
||||
// do check for last line
|
||||
if (minIndex == maxIndex && offset >= fBuffer[maxIndex].offset)
|
||||
index = maxIndex;
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
@ -91,10 +87,6 @@ BTextView::LineBuffer::PixelToLine(float pixel) const
|
||||
maxIndex = index;
|
||||
}
|
||||
|
||||
// do check for last line
|
||||
if (minIndex == maxIndex && pixel >= fBuffer[maxIndex].origin)
|
||||
index = maxIndex;
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user