From eaafa73f0df9d20c60f693faf641e896c6333095 Mon Sep 17 00:00:00 2001
From: x-ist <fakeEmail@fakesite.fake>
Date: Mon, 6 Aug 2012 19:44:42 +0000
Subject: [PATCH] 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.
---
src/kits/interface/TextView.cpp | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/kits/interface/TextView.cpp b/src/kits/interface/TextView.cpp
index d46414d..8ed8cea 100644
a
|
b
|
BTextView::_StyledWidth(int32 fromOffset, int32 length, float* outAscent,
|
4198 | 4198 | float |
4199 | 4199 | BTextView::_ActualTabWidth(float location) const |
4200 | 4200 | { |
4201 | | return fTabWidth - fmod(location, fTabWidth); |
| 4201 | float tabWidth = fTabWidth - fmod(location, fTabWidth); |
| 4202 | if (round(tabWidth) == 0) |
| 4203 | tabWidth = fTabWidth; |
| 4204 | |
| 4205 | return tabWidth; |
4202 | 4206 | } |
4203 | 4207 | |
4204 | 4208 | |