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:
parent
6e3918fa63
commit
6e1a7a15cd
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user