Allow switching whitespace visibility in source code view.

This commit is contained in:
Bartosz Taudul 2019-06-22 14:24:39 +02:00
parent 53fe688bff
commit e33690c5f3
2 changed files with 6 additions and 0 deletions

View File

@ -151,6 +151,7 @@ void View::InitTextEditor()
m_textEditor = std::make_unique<TextEditor>();
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();

View File

@ -310,6 +310,7 @@ private:
std::unique_ptr<TextEditor> m_textEditor;
const char* m_textEditorFile;
ImFont* m_textEditorFont;
bool m_textEditorWhitespace = true;
float m_rootWidth, m_rootHeight;
SetTitleCallback m_stcb;