From 51fcf80fe01067a42c8b01709986a1abcb33bb05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Mon, 17 Nov 2025 19:40:01 -0300 Subject: [PATCH] Fix minor bug when changing terminal font and creating a new terminal was still using the old font. --- src/tools/ecode/ecode.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/tools/ecode/ecode.cpp b/src/tools/ecode/ecode.cpp index bd5ccdc25..da0e1c525 100644 --- a/src/tools/ecode/ecode.cpp +++ b/src/tools/ecode/ecode.cpp @@ -470,19 +470,23 @@ void App::openFontDialog( std::string& fontPath, bool loadingMonoFont, bool term auto loadMonoFont = [this, &fontPath, newPath, terminalFont]( FontTrueType* fontMono ) { fontPath = newPath; - mFontMono = fontMono; - mFontMono->setEnableDynamicMonospace( true ); - mFontMono->setBoldAdvanceSameAsRegular( true ); - FontFamily::loadFromRegular( mFontMono ); + if ( terminalFont ) + mTerminalFont = fontMono; + else + mFontMono = fontMono; + fontMono->setEnableDynamicMonospace( true ); + fontMono->setBoldAdvanceSameAsRegular( true ); + FontFamily::loadFromRegular( fontMono ); if ( mSplitter ) { if ( terminalFont ) { mSplitter->forEachWidgetType( - UI_TYPE_TERMINAL, [this]( UIWidget* term ) { - term->asType()->setFont( mFontMono ); + UI_TYPE_TERMINAL, [fontMono]( UIWidget* term ) { + term->asType()->setFont( fontMono ); } ); } else { - mSplitter->forEachEditor( - [this]( UICodeEditor* editor ) { editor->setFont( mFontMono ); } ); + mSplitter->forEachEditor( [fontMono]( UICodeEditor* editor ) { + editor->setFont( fontMono ); + } ); } } };