aboutsummaryrefslogtreecommitdiff
path: root/gui/widgets/tab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gui/widgets/tab.cpp')
-rw-r--r--gui/widgets/tab.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp
index ed261c98ec..cf9dd5d962 100644
--- a/gui/widgets/tab.cpp
+++ b/gui/widgets/tab.cpp
@@ -199,6 +199,12 @@ void TabWidget::setActiveTab(int tabID) {
}
_activeTab = tabID;
_firstWidget = _tabs[tabID].firstWidget;
+
+ // Also ensure the tab is visible in the tab bar
+ if (_firstVisibleTab > tabID)
+ _firstVisibleTab = tabID;
+ else if (_firstVisibleTab + _w / _tabWidth <= tabID)
+ _firstVisibleTab = tabID - _w / _tabWidth + 1;
_boss->draw();
}