From 471ed0ef65776d39b993a05ecc3d9f73f3271617 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 4 Oct 2024 22:41:17 +0200 Subject: [PATCH] Calculate proper message list size when children messages are excluded. --- profiler/src/profiler/TracyView_ZoneInfo.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/profiler/src/profiler/TracyView_ZoneInfo.cpp b/profiler/src/profiler/TracyView_ZoneInfo.cpp index 6a788020..c5b56790 100644 --- a/profiler/src/profiler/TracyView_ZoneInfo.cpp +++ b/profiler/src/profiler/TracyView_ZoneInfo.cpp @@ -930,7 +930,25 @@ void View::DrawZoneInfoWindow() SmallCheckbox( "Time relative to zone start", &m_messageTimeRelativeToZone ); ImGui::SameLine(); SmallCheckbox( "Exclude children", &m_messagesExcludeChildren ); - if( ImGui::BeginTable( "##messages", 2, ImGuiTableFlags_ScrollY | ImGuiTableFlags_BordersInnerV, ImVec2( 0, ImGui::GetTextLineHeightWithSpacing() * std::min( msgend-msgit+1, 15 ) ) ) ) + int64_t viewSize; + if( !m_messagesExcludeChildren ) + { + viewSize = std::min( msgend - msgit + 1, 15 ); + } + else + { + viewSize = 0; + for( auto it = msgit; it < msgend; ++it ) + { + if( !GetZoneChild( ev, (*it)->time ) ) + { + viewSize++; + if( viewSize == 15 ) break; + } + } + if( viewSize < 15 ) viewSize++; + } + if( ImGui::BeginTable( "##messages", 2, ImGuiTableFlags_ScrollY | ImGuiTableFlags_BordersInnerV, ImVec2( 0, ImGui::GetTextLineHeightWithSpacing() * viewSize ) ) ) { ImGui::TableSetupScrollFreeze( 0, 1 ); ImGui::TableSetupColumn( "Time", ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_NoResize );