From 14ec7ea6cdf098731d05e238920d0f7ef7fdcff0 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 10 Apr 2020 00:37:46 +0200 Subject: [PATCH] Tighten line numbers in source view. --- server/TracySourceView.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index ef652378..f7400546 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -857,11 +857,14 @@ void SourceView::RenderLine( const Line& line, int lineNum, uint32_t ipcnt, uint ImGui::SameLine( 0, ty ); } + const auto lineCount = m_lines.size(); + const auto tmp = RealToString( lineCount ); + const auto maxLine = strlen( tmp ); const auto lineString = RealToString( lineNum ); const auto linesz = strlen( lineString ); char buf[16]; - memset( buf, ' ', 7 - linesz ); - memcpy( buf + 7 - linesz, lineString, linesz+1 ); + memset( buf, ' ', maxLine - linesz ); + memcpy( buf + maxLine - linesz, lineString, linesz+1 ); TextDisabledUnformatted( buf ); ImGui::SameLine( 0, ty );