From e33690c5f38e9670588d8d3ad0f76dd50bafe378 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 22 Jun 2019 14:24:39 +0200 Subject: [PATCH] Allow switching whitespace visibility in source code view. --- server/TracyView.cpp | 5 +++++ server/TracyView.hpp | 1 + 2 files changed, 6 insertions(+) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 4d054e15..9830001b 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -151,6 +151,7 @@ void View::InitTextEditor() m_textEditor = std::make_unique(); m_textEditor->SetReadOnly( true ); m_textEditor->SetLanguageDefinition( TextEditor::LanguageDefinition::CPlusPlus() ); + m_textEditor->SetShowWhitespaces( m_textEditorWhitespace ); m_textEditorFile = nullptr; } @@ -8847,6 +8848,10 @@ void View::DrawTextEditor() TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), "/!\\" ); #endif TextFocused( "File:", m_textEditorFile ); + if( SmallCheckbox( "Show whitespace", &m_textEditorWhitespace ) ); + { + m_textEditor->SetShowWhitespaces( m_textEditorWhitespace ); + } if( m_textEditorFont ) ImGui::PushFont( m_textEditorFont ); m_textEditor->Render( m_textEditorFile, ImVec2(), true ); if( m_textEditorFont ) ImGui::PopFont(); diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 3cf2f5bc..ae57a973 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -310,6 +310,7 @@ private: std::unique_ptr m_textEditor; const char* m_textEditorFile; ImFont* m_textEditorFont; + bool m_textEditorWhitespace = true; float m_rootWidth, m_rootHeight; SetTitleCallback m_stcb;