[haiku-commits] haiku: hrev44500 - src/kits/interface

  • From: leavengood@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 9 Aug 2012 04:24:35 +0200 (CEST)

hrev44500 adds 1 changeset to branch 'master'
old head: 6e3918fa63cf2657089ccb2eccc3820ab3e1f86e
new head: 6e1a7a15cd824d8ba1846fa8f009e55e6d21bec3

----------------------------------------------------------------------------

6e1a7a1: Fix BTextView tab calculation.
  
  In rare cases such as described in #7955 BTextView happens to calculate the
  width of a tab close to zero (e.g. 0.000031). This patch adds a fallback to 
the
  default tab width in that case.
  
  Signed-off-by: Ryan Leavengood <leavengood@xxxxxxxxx>

                                         [ x-ist <fakeEmail@xxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev44500
Commit:      6e1a7a15cd824d8ba1846fa8f009e55e6d21bec3
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6e1a7a1
Author:      x-ist <fakeEmail@xxxxxxxxxxxxx>
Date:        Mon Aug  6 19:44:42 2012 UTC
Committer:   Ryan Leavengood <leavengood@xxxxxxxxx>
Commit-Date: Thu Aug  9 02:17:38 2012 UTC

Ticket:      https://dev.haiku-os.org/ticket/7955

----------------------------------------------------------------------------

1 file changed, 5 insertions(+), 1 deletion(-)
src/kits/interface/TextView.cpp |    6 +++++-

----------------------------------------------------------------------------

diff --git a/src/kits/interface/TextView.cpp b/src/kits/interface/TextView.cpp
index d46414d..f935828 100644
--- a/src/kits/interface/TextView.cpp
+++ b/src/kits/interface/TextView.cpp
@@ -4198,7 +4198,11 @@ BTextView::_StyledWidth(int32 fromOffset, int32 length, 
float* outAscent,
 float
 BTextView::_ActualTabWidth(float location) const
 {
-       return fTabWidth - fmod(location, fTabWidth);
+       float tabWidth = fTabWidth - fmod(location, fTabWidth);
+       if (round(tabWidth) == 0)
+               tabWidth = fTabWidth;
+
+       return tabWidth;
 }
 
 


Other related posts:

  • » [haiku-commits] haiku: hrev44500 - src/kits/interface - leavengood