TabbedButtonBar and currentTabIndex after closing tab

I think closing an unselected tab with an index lower of the currently selected tab results in a wrong currentTabIndex.

[code] const int oldTabIndex = currentTabIndex;
if (currentTabIndex == tabIndex)
currentTabIndex = -1;

    tabs.remove (tabIndex);

    setCurrentTabIndex (jlimit (0, jmax (0, tabs.size() - 1), oldTabIndex));[/code]

Suppose I am using tab 6 and closing tab 4, setCurrentTabIndex will receive oldTabIndex, which is currentTabIndex, which is 6 (or 5 if 6 was the last tab).
I think setCurrectTabIndex should be called with oldTabIndex - 1 in this case.

What do you think?

Yes, good point, thanks! I’ll take a look at that…