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 <[email protected]>
This commit is contained in:
@@ -4198,7 +4198,11 @@ BTextView::_StyledWidth(int32 fromOffset, int32 length, float* outAscent,
|
|||||||
float
|
float
|
||||||
BTextView::_ActualTabWidth(float location) const
|
BTextView::_ActualTabWidth(float location) const
|
||||||
{
|
{
|
||||||
return fTabWidth - fmod(location, fTabWidth);
|
float tabWidth = fTabWidth - fmod(location, fTabWidth);
|
||||||
|
if (round(tabWidth) == 0)
|
||||||
|
tabWidth = fTabWidth;
|
||||||
|
|
||||||
|
return tabWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user