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@gmail.com>
This commit is contained in:
x-ist 2012-08-06 19:44:42 +00:00 committed by Ryan Leavengood
parent 6e3918fa63
commit 6e1a7a15cd

View File

@ -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;
}