From 1103c53a39a8789923873fc9a431be4c018ec481 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sun, 30 Jun 2013 10:32:19 -0400 Subject: [PATCH] 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. --- src/kits/interface/TabView.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/kits/interface/TabView.cpp b/src/kits/interface/TabView.cpp index 157b4531dc..452314c8c9 100644 --- a/src/kits/interface/TabView.cpp +++ b/src/kits/interface/TabView.cpp @@ -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);