* 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:
@@ -1771,24 +1771,32 @@ BTextView::PointAt(int32 inOffset, float *outHeight) const
|
|||||||
} else {
|
} else {
|
||||||
height = (line + 1)->origin - line->origin;
|
height = (line + 1)->origin - line->origin;
|
||||||
|
|
||||||
int32 offset = line->offset;
|
// special case: go down one line if inOffset is a newline
|
||||||
int32 length = inOffset - line->offset;
|
if (inOffset == TextLength() && inOffset > 0
|
||||||
int32 numBytes = length;
|
&& fText->RealCharAt(inOffset - 1) == B_ENTER) {
|
||||||
bool foundTab = false;
|
result.y += height;
|
||||||
do {
|
height = LineHeight(CountLines() - 1);
|
||||||
foundTab = fText->FindChar(B_TAB, offset, &numBytes);
|
|
||||||
float width = _StyledWidth(offset, numBytes);
|
|
||||||
result.x += width;
|
|
||||||
|
|
||||||
if (foundTab) {
|
} else {
|
||||||
result.x += _ActualTabWidth(result.x);
|
int32 offset = line->offset;
|
||||||
numBytes++;
|
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;
|
if (foundTab) {
|
||||||
length -= numBytes;
|
result.x += _ActualTabWidth(result.x);
|
||||||
numBytes = length;
|
numBytes++;
|
||||||
} while (foundTab && length > 0);
|
}
|
||||||
|
|
||||||
|
offset += numBytes;
|
||||||
|
length -= numBytes;
|
||||||
|
numBytes = length;
|
||||||
|
} while (foundTab && length > 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fAlignment != B_ALIGN_LEFT) {
|
if (fAlignment != B_ALIGN_LEFT) {
|
||||||
|
|||||||
@@ -65,10 +65,6 @@ BTextView::LineBuffer::OffsetToLine(int32 offset) const
|
|||||||
maxIndex = index;
|
maxIndex = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// do check for last line
|
|
||||||
if (minIndex == maxIndex && offset >= fBuffer[maxIndex].offset)
|
|
||||||
index = maxIndex;
|
|
||||||
|
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,10 +87,6 @@ BTextView::LineBuffer::PixelToLine(float pixel) const
|
|||||||
maxIndex = index;
|
maxIndex = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// do check for last line
|
|
||||||
if (minIndex == maxIndex && pixel >= fBuffer[maxIndex].origin)
|
|
||||||
index = maxIndex;
|
|
||||||
|
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user