UI: Run builder before moving it

This commit is contained in:
Luke Street
2026-04-30 01:07:11 -06:00
parent 4a12554bf4
commit 37d1aa7f40
+4 -2
View File
@@ -184,6 +184,9 @@ bool Window::set_active_tab(int index) {
void Window::add_tab(const Rml::String& title, TabBuilder builder) {
const int index = static_cast<int>(mTabs.size());
if (index == mSelectedTabIndex && builder) {
builder(mDocument->GetElementById("content"));
}
auto* tabBar = mDocument->GetElementById("tab-bar");
mTabs.emplace_back(Tab{
.title = title,
@@ -196,8 +199,7 @@ void Window::add_tab(const Rml::String& title, TabBuilder builder) {
"tab"),
.builder = std::move(builder),
});
if (index == mSelectedTabIndex && builder) {
builder(mDocument->GetElementById("content"));
if (index == mSelectedTabIndex) {
focus_active_tab();
}
}