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:
Rene Gollent
2013-06-30 10:32:19 -04:00
parent eaedb2f8a4
commit 1103c53a39
+3 -6
View File
@@ -430,7 +430,7 @@ BTabView::BTabView(BMessage *archive)
}
if (archive->FindInt32("_sel", &fSelection) != B_OK)
fSelection = 0;
fSelection = -1;
if (archive->FindInt32("_border_style", (int32*)&fBorderStyle) != B_OK)
fBorderStyle = B_FANCY_BORDER;
@@ -1243,13 +1243,10 @@ BTabView::RemoveTab(int32 index)
if (fContainerView->GetLayout())
fContainerView->GetLayout()->RemoveItem(index);
if (index <= fSelection && fSelection != 0)
fSelection--;
if (CountTabs() == 0)
fFocus = -1;
else
Select(fSelection);
else if (index <= fSelection)
Select(fSelection - 1);
if (fFocus == CountTabs() - 1 || CountTabs() == 0)
SetFocusTab(fFocus, false);