Fixing #3040 (DeskCalcs textview showing wrong/multiple styles)
* fixed crash in StyleBuffer::SetStyleFromMode() if any of the given pointers is NULL (which is perfectly valid) * BTextView::SetFontAndColor() now syncs the null style before it sets the range, thus making sure that there is only one style if the view is not stylable git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30516 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1619,6 +1619,7 @@ BTextView::SetFontAndColor(int32 startOffset, int32 endOffset,
|
|||||||
endOffset = textLength;
|
endOffset = textLength;
|
||||||
|
|
||||||
// add the style to the style buffer
|
// add the style to the style buffer
|
||||||
|
fStyles->SyncNullStyle(startOffset);
|
||||||
fStyles->SetStyleRange(startOffset, endOffset, fText->Length(),
|
fStyles->SetStyleRange(startOffset, endOffset, fText->Length(),
|
||||||
fontMode, &newFont, color);
|
fontMode, &newFont, color);
|
||||||
|
|
||||||
|
|||||||
@@ -159,16 +159,19 @@ static void
|
|||||||
SetStyleFromMode(uint32 mode, const BFont *fromFont, BFont *toFont,
|
SetStyleFromMode(uint32 mode, const BFont *fromFont, BFont *toFont,
|
||||||
const rgb_color *fromColor, rgb_color *toColor)
|
const rgb_color *fromColor, rgb_color *toColor)
|
||||||
{
|
{
|
||||||
if (mode & B_FONT_FAMILY_AND_STYLE)
|
if (fromFont != NULL && toFont != NULL) {
|
||||||
toFont->SetFamilyAndStyle(fromFont->FamilyAndStyle());
|
if (mode & B_FONT_FAMILY_AND_STYLE)
|
||||||
|
toFont->SetFamilyAndStyle(fromFont->FamilyAndStyle());
|
||||||
|
|
||||||
if (mode & B_FONT_SIZE)
|
if (mode & B_FONT_SIZE)
|
||||||
toFont->SetSize(fromFont->Size());
|
toFont->SetSize(fromFont->Size());
|
||||||
|
|
||||||
if (mode & B_FONT_SHEAR)
|
if (mode & B_FONT_SHEAR)
|
||||||
toFont->SetShear(fromFont->Shear());
|
toFont->SetShear(fromFont->Shear());
|
||||||
|
}
|
||||||
|
|
||||||
if (!mode || (mode == B_FONT_ALL))
|
if (fromColor != NULL && toColor != NULL
|
||||||
|
&& (mode == 0 || mode == B_FONT_ALL))
|
||||||
*toColor = *fromColor;
|
*toColor = *fromColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user