Fix another BTabView problem.
BTabView::RemoveTab() directly manipulated the selected index, which would cause problems in conjunction with the recently introduced short circuit, most notably observable in Terminal.
This commit is contained in:
@@ -430,7 +430,7 @@ BTabView::BTabView(BMessage *archive)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (archive->FindInt32("_sel", &fSelection) != B_OK)
|
if (archive->FindInt32("_sel", &fSelection) != B_OK)
|
||||||
fSelection = 0;
|
fSelection = -1;
|
||||||
|
|
||||||
if (archive->FindInt32("_border_style", (int32*)&fBorderStyle) != B_OK)
|
if (archive->FindInt32("_border_style", (int32*)&fBorderStyle) != B_OK)
|
||||||
fBorderStyle = B_FANCY_BORDER;
|
fBorderStyle = B_FANCY_BORDER;
|
||||||
@@ -1243,13 +1243,10 @@ BTabView::RemoveTab(int32 index)
|
|||||||
if (fContainerView->GetLayout())
|
if (fContainerView->GetLayout())
|
||||||
fContainerView->GetLayout()->RemoveItem(index);
|
fContainerView->GetLayout()->RemoveItem(index);
|
||||||
|
|
||||||
if (index <= fSelection && fSelection != 0)
|
|
||||||
fSelection--;
|
|
||||||
|
|
||||||
if (CountTabs() == 0)
|
if (CountTabs() == 0)
|
||||||
fFocus = -1;
|
fFocus = -1;
|
||||||
else
|
else if (index <= fSelection)
|
||||||
Select(fSelection);
|
Select(fSelection - 1);
|
||||||
|
|
||||||
if (fFocus == CountTabs() - 1 || CountTabs() == 0)
|
if (fFocus == CountTabs() - 1 || CountTabs() == 0)
|
||||||
SetFocusTab(fFocus, false);
|
SetFocusTab(fFocus, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user