From a8945c367be54e7de00373cffe11f18576f9fe4f Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Wed, 23 Aug 2006 10:11:44 +0000 Subject: [PATCH] added +1 to the textrect width in AutoResize(). Maybe it needs still more space. Fixes bug 764. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18584 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/BTextView/TextView.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/kits/interface/BTextView/TextView.cpp b/src/kits/interface/BTextView/TextView.cpp index fe187dcfe8..b21bdedf11 100644 --- a/src/kits/interface/BTextView/TextView.cpp +++ b/src/kits/interface/BTextView/TextView.cpp @@ -1991,6 +1991,11 @@ BTextView::ScrollToOffset(int32 inOffset) float lineHeight = 0.0; BPoint point = PointAt(inOffset, &lineHeight); + // TODO: We should do the following, since otherwise the textview + // won't scroll unless it's attached to a scrollview. + /*if (!bounds.Contains(point)) + ScrollTo(point); */ + if (ScrollBar(B_HORIZONTAL) != NULL) { if (point.x < bounds.left || point.x >= bounds.right) ScrollBar(B_HORIZONTAL)->SetValue(point.x - (bounds.IntegerWidth() / 2)); @@ -4016,7 +4021,7 @@ BTextView::AutoResize(bool redraw) for (int32 i = 0; i < CountLines(); i++) newWidth += LineWidth(i); - BRect newRect(0, 0, ceilf(newWidth), ceilf(TextHeight(0, 0)) + 1); + BRect newRect(0, 0, ceilf(newWidth) + 1, ceilf(TextHeight(0, 0)) + 1); if (fContainerView != NULL) { fContainerView->ResizeTo(newRect.Width(), newRect.Height());