From 2420234dff025a6097708077472430cb6b315cd9 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Mon, 17 Apr 2006 14:09:32 +0000 Subject: [PATCH] BTextView::AutoResize() wasn't still completely correct, causing bug 464 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17152 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/BTextView/TextView.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/kits/interface/BTextView/TextView.cpp b/src/kits/interface/BTextView/TextView.cpp index 08e55d6490..969aa26c96 100644 --- a/src/kits/interface/BTextView/TextView.cpp +++ b/src/kits/interface/BTextView/TextView.cpp @@ -4024,19 +4024,17 @@ BTextView::AutoResize(bool redraw) width += fTextRect.left + textRectPadding; width = ceilf(width); - if (fContainerView != NULL) - fContainerView->ResizeTo(width, max_c(Bounds().Height(), TextHeight(0, CountLines()))); - - BView *view = fContainerView != NULL ? fContainerView : this; - if (fAlignment == B_ALIGN_CENTER) - view->MoveBy((oldWidth - width) / 2, 0); - else if (fAlignment == B_ALIGN_RIGHT) - view->MoveBy(oldWidth - width, 0); - - if (fContainerView) + if (fContainerView != NULL) { + fContainerView->ResizeTo(width, max_c(Bounds().Height(), TextHeight(0, CountLines()))); + if (fAlignment == B_ALIGN_CENTER) + fContainerView->MoveBy((oldWidth - width) / 2, 0); + else if (fAlignment == B_ALIGN_RIGHT) + fContainerView->MoveBy(oldWidth - width, 0); fContainerView->Invalidate(); + } fTextRect.right = Bounds().right - textRectPadding; + if (redraw) DrawLines(0, CountLines()); }