From 5d56e4da3409480b8bd0fcabde59383eb7e86988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Thu, 22 Jan 2026 01:41:25 -0300 Subject: [PATCH] Added String::formatBuffer for char32_t strings. Minor fixes in breeze theme. --- bin/assets/ui/breeze.css | 10 ++++++++- include/eepp/core/string.hpp | 5 +++++ src/eepp/core/string.cpp | 35 +++++++++++++++++++++++++++++++ src/tools/ecode/applayout.xml.hpp | 10 ++++++++- 4 files changed, 58 insertions(+), 2 deletions(-) diff --git a/bin/assets/ui/breeze.css b/bin/assets/ui/breeze.css index c7930b461..0d99d09a4 100644 --- a/bin/assets/ui/breeze.css +++ b/bin/assets/ui/breeze.css @@ -143,6 +143,8 @@ DropDownList { border-radius: var(--button-radius); border-width: var(--border-width); transition: all 0.125s cubic-bezier(0.77, 0.77, 0.38, 0.38); + color: var(--font); + tint: var(--font); } DropDownList, @@ -166,6 +168,8 @@ SelectButton:pressed, SelectButton:selected, SelectButton:selected:pressed { background-color: var(--primary); + color: var(--list-row-active); + tint: var(--list-row-active); } pushbutton:disabled, @@ -306,6 +310,8 @@ DropDownList::ListBox::item, ComboBox::DropDownList::ListBox::item { padding-left: 4dp; background-color: transparent; + color: var(--font); + tint: var(--font); } DropDownList::ListBox::item:hover, @@ -313,6 +319,8 @@ DropDownList::ListBox::item:selected, ComboBox::DropDownList::ListBox::item:hover, ComboBox::DropDownList::ListBox::item:selected { background-color: var(--primary); + color: var(--list-row-active); + tint: var(--list-row-active); } TextInput, @@ -937,7 +945,7 @@ listview::header::column:hover, tableview::rowheader::row:hover, treeview::rowheader::row:hover, listview::rowheader::row:hover { - background-color: var(--item-hover); + background-color: var(--item-hover); } tableview::row, diff --git a/include/eepp/core/string.hpp b/include/eepp/core/string.hpp index 136374c53..78859133e 100644 --- a/include/eepp/core/string.hpp +++ b/include/eepp/core/string.hpp @@ -509,6 +509,10 @@ class EE_API String { /** Format a char buffer */ static void formatBuffer( char* Buffer, int BufferSize, const char* format, ... ); + /** Format a UTF-32 buffer */ + static String::View formatBuffer( String::StringBaseType* Buffer, int BufferSize, + const char* format, ... ); + /** @brief Construct from an UTF-8 string to UTF-32 according ** @param utf8String UTF-8 string to convert **/ @@ -1175,6 +1179,7 @@ class EE_API String { * @param str The string to strip */ static void stripAnsiCodes( std::string& str ); + private: friend EE_API bool operator==( const String& left, const String& right ); friend EE_API bool operator<( const String& left, const String& right ); diff --git a/src/eepp/core/string.cpp b/src/eepp/core/string.cpp index 599735218..84f7c59c5 100644 --- a/src/eepp/core/string.cpp +++ b/src/eepp/core/string.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -1616,6 +1617,40 @@ void String::formatBuffer( char* Buffer, int BufferSize, const char* format, ... va_end( args ); } +String::View String::formatBuffer( String::StringBaseType* Buffer, int BufferSize, + const char* format, ... ) { + static constexpr std::size_t PMR_LOCAL_BUFFER_SIZE = 512; + alignas( std::max_align_t ) std::array stack_buffer; + std::pmr::monotonic_buffer_resource mbr( stack_buffer.data(), stack_buffer.size(), + std::pmr::get_default_resource() ); + std::pmr::vector pmrBuf( static_cast( BufferSize ), &mbr ); + if ( !pmrBuf.empty() ) + pmrBuf[0] = '\0'; + va_list args; + va_start( args, format ); + int result_len = 0; +#ifdef EE_COMPILER_MSVC + result_len = _vsnprintf_s( pmrBuf.data(), pmrBuf.size(), pmrBuf.size() - 1, format, args ); + if ( result_len < 0 && !pmrBuf.empty() ) { + pmrBuf.back() = '\0'; + result_len = static_cast( pmrBuf.size() - 1 ); + } else if ( result_len < 0 ) { + result_len = 0; + } +#else + result_len = vsnprintf( pmrBuf.data(), pmrBuf.size(), format, args ); + if ( result_len >= static_cast( pmrBuf.size() ) ) { + result_len = static_cast( pmrBuf.size() - 1 ); + } else if ( result_len < 0 ) { + result_len = 0; + if ( !pmrBuf.empty() ) + pmrBuf[0] = '\0'; + } +#endif + va_end( args ); + return String::View{ Buffer, String::toUtf32( pmrBuf.data(), Buffer, BufferSize ) }; +} + String::String() {} String::String( char ansiChar ) { diff --git a/src/tools/ecode/applayout.xml.hpp b/src/tools/ecode/applayout.xml.hpp index ebce9f09f..edcc64402 100644 --- a/src/tools/ecode/applayout.xml.hpp +++ b/src/tools/ecode/applayout.xml.hpp @@ -317,11 +317,19 @@ TableView#locate_bar_table > tableview::row:selected > tableview::cell:nth-child background-color: rgba(0,0,0, 0.1); } .settings_panel .advanced_options .title { - padding-bottom: 4dp; + padding-right: 4dp; border-radius: 4dp; background-color: transparent; transition: background-color 100ms; } +.settings_panel .advanced_options .title > * { + color: var(--font); + tint: var(--font); +} +.settings_panel .advanced_options .title:hover > * { + color: var(--list-row-active); + tint: var(--list-row-active); +} .settings_panel .advanced_options .title:hover { background-color: var(--primary); }