From 62ac5544b6b0a6da5953667304ef00f16304d9ea Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 27 Mar 2021 13:55:22 +0100 Subject: [PATCH] Trim empty lines at top and bottom of source preview. --- server/TracySourceView.cpp | 11 ++++++++++- server/TracyView.cpp | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index c8a15f98..fc54e8ba 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -2554,15 +2554,24 @@ void SourceView::RenderAsmLine( AsmLine& line, uint32_t ipcnt, uint32_t iptotal, auto& lines = m_sourceTooltip.get(); const int start = std::max( 0, (int)srcline - 4 ); const int end = std::min( m_sourceTooltip.get().size(), srcline + 3 ); + bool first = true; + int bottomEmpty = 0; for( int i=start; i 0 ) + { + ImGui::TextUnformatted( "" ); + bottomEmpty--; + } + auto ptr = line.begin; auto it = line.tokens.begin(); while( ptr < line.end ) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index bf79e187..86627ef0 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -17843,15 +17843,24 @@ void View::DrawSourceTooltip( const char* filename, uint32_t srcline, int before auto& lines = m_srcHintCache.get(); const int start = std::max( 0, (int)srcline - ( before+1 ) ); const int end = std::min( m_srcHintCache.get().size(), srcline + after ); + bool first = true; + int bottomEmpty = 0; for( int i=start; i 0 ) + { + ImGui::TextUnformatted( "" ); + bottomEmpty--; + } + auto ptr = line.begin; auto it = line.tokens.begin(); while( ptr < line.end )