Ticket #3438: 0001-Tracker-always-shrink-the-text-input-when-renaming.patch

File 0001-Tracker-always-shrink-the-text-input-when-renaming.patch, 1.4 KB (added by gbl08ma, 8 years ago)
  • src/kits/tracker/TextWidget.cpp

    From 8a87c346a2ecf0b1e0c3bf104d89236d58b79686 Mon Sep 17 00:00:00 2001
    From: Gabriel Maia <gbl08ma@gmail.com>
    Date: Wed, 7 Sep 2016 21:47:16 +0000
    Subject: [PATCH] Tracker: always shrink the text input when renaming
    
    When renaming an entry at the edge of a PoseView, the input
    would not resize as usual. This change ensures the input
    becomes resizable again if the text becomes small enough.
    Fixes #3438.
    ---
     src/kits/tracker/TextWidget.cpp | 11 +++++++++--
     1 file changed, 9 insertions(+), 2 deletions(-)
    
    diff --git a/src/kits/tracker/TextWidget.cpp b/src/kits/tracker/TextWidget.cpp
    index 9a65332..53a8e9b 100644
    a b TextViewFilter(BMessage* message, BHandler**, BMessageFilter* filter)  
    333333        BTextView* textView = dynamic_cast<BTextView*>(
    334334            scrollView->FindView("WidgetTextView"));
    335335        if (textView != NULL) {
     336            BRect textRect = textView->TextRect();
    336337            BRect rect = scrollView->Frame();
    337338
    338             if (rect.right + 3 > poseView->Bounds().right
    339                 || rect.left - 3 < 0)
     339            if (rect.right + 5 > poseView->Bounds().right
     340                || rect.left - 5 < 0)
    340341                textView->MakeResizable(true, NULL);
     342
     343            if (textRect.Width() + 10 < rect.Width()) {
     344                textView->MakeResizable(true, scrollView);
     345                // make sure no empty white space stays on the right
     346                textView->ScrollToOffset(0);
     347            }
    341348        }
    342349    }
    343350