From 20c826d2ae0b3cabbbeaf5bb157f73eaddaad9dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Tue, 7 Apr 2026 13:27:07 -0300 Subject: [PATCH] Some minor stuff. --- src/eepp/graphics/richtext.cpp | 10 ++++++---- src/eepp/ui/uirichtext.cpp | 7 ++++--- src/eepp/ui/uitextinput.cpp | 8 ++++---- .../src/eepp/ui/doc/languages/typescript.cpp | 2 +- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/eepp/graphics/richtext.cpp b/src/eepp/graphics/richtext.cpp index a6f9fb19c..f470f9f0a 100644 --- a/src/eepp/graphics/richtext.cpp +++ b/src/eepp/graphics/richtext.cpp @@ -386,12 +386,13 @@ Float RichText::getMaxIntrinsicWidth() { size_t end = 0; while ( ( end = s.find( '\n', start ) ) != String::InvalidPos ) { curX += Text::getTextWidth( s.substr( start, end - start ), - span->getFontStyleConfig() ); + span->getFontStyleConfig(), 4, span->getTextHints() ); maxW = std::max( maxW, curX ); curX = 0; start = end + 1; } - curX += Text::getTextWidth( s.substr( start ), span->getFontStyleConfig() ); + curX += Text::getTextWidth( s.substr( start ), span->getFontStyleConfig(), 4, + span->getTextHints() ); } else if ( auto pDrawable = std::get_if>( &block ) ) { curX += ( *pDrawable )->getPixelsSize().getWidth(); } else if ( auto pSize = std::get_if( &block ) ) { @@ -491,7 +492,8 @@ void RichText::updateLayout() { } // Wrap if needed - if ( mMaxWidth > 0 && curX + blockSize.getWidth() > mMaxWidth && curX > 0 ) { + if ( mMaxWidth > 0 && + ( curX + blockSize.getWidth() >= mMaxWidth || curX >= mMaxWidth ) && curX > 0 ) { maxWidth = std::max( maxWidth, curX ); mLines.push_back( RenderParagraph() ); curX = 0; @@ -514,7 +516,7 @@ void RichText::updateLayout() { curX += blockSize.getWidth(); currentLine.width += blockSize.getWidth(); - if ( mMaxWidth > 0 && curX + blockSize.getWidth() > mMaxWidth && curX > 0 ) { + if ( mMaxWidth > 0 && curX >= mMaxWidth ) { maxWidth = std::max( maxWidth, curX ); mLines.push_back( RenderParagraph() ); curX = 0; diff --git a/src/eepp/ui/uirichtext.cpp b/src/eepp/ui/uirichtext.cpp index 463b61cfa..443d3f184 100644 --- a/src/eepp/ui/uirichtext.cpp +++ b/src/eepp/ui/uirichtext.cpp @@ -526,9 +526,10 @@ void UIRichText::rebuildRichText( RichText& richText, IntrinsicMode mode ) { if ( mode == IntrinsicMode::None ) { if ( widget->getLayoutWidthPolicy() == SizePolicy::MatchParent ) { if ( mSize.getWidth() != 0 ) { - widget->setPixelsSize( eemax( 0.f, mSize.getWidth() - mPaddingPx.Left - - mPaddingPx.Right - margin.Left - - margin.Right ), + Float maxSize = + eemax( 0.f, mSize.getWidth() - mPaddingPx.Left - mPaddingPx.Right - + margin.Left - margin.Right ); + widget->setPixelsSize( eemax( 0.f, maxSize ), widget->getPixelsSize().getHeight() ); } else { onAutoSizeChild( widget ); diff --git a/src/eepp/ui/uitextinput.cpp b/src/eepp/ui/uitextinput.cpp index eac38591f..3610b82ec 100644 --- a/src/eepp/ui/uitextinput.cpp +++ b/src/eepp/ui/uitextinput.cpp @@ -142,7 +142,7 @@ void UITextInput::draw() { if ( textCache.getTextWidth() ) { drawSelection( textCache ); - if ( isClipped() ) { + if ( mMode == TextInputMode::Password && isClipped() ) { clipSmartEnable( mScreenPos.x + mPaddingPx.Left, mScreenPos.y + mPaddingPx.Top, mSize.getWidth() - mPaddingPx.Left - mPaddingPx.Right, mSize.getHeight() - mPaddingPx.Top - mPaddingPx.Bottom ); @@ -154,12 +154,12 @@ void UITextInput::draw() { std::trunc( mScreenPos.y ) + (int)mRealAlignOffset.y + (int)mPaddingPx.Top, Vector2f::One, 0.f, getBlendMode() ); - if ( isClipped() ) { + if ( mMode == TextInputMode::Password && isClipped() ) { clipSmartDisable(); } } else if ( !mHintCache->getString().empty() && ( mHintDisplay == HintDisplay::Always || hasFocus() ) ) { - if ( isClipped() ) { + if ( mMode == TextInputMode::Password && isClipped() ) { clipSmartEnable( mScreenPos.x + mPaddingPx.Left, mScreenPos.y + mPaddingPx.Top, mSize.getWidth() - mPaddingPx.Left - mPaddingPx.Right, mSize.getHeight() - mPaddingPx.Top - mPaddingPx.Bottom ); @@ -170,7 +170,7 @@ void UITextInput::draw() { std::trunc( mScreenPos.y ) + (int)mRealAlignOffset.y + (int)mPaddingPx.Top, Vector2f::One, 0.f, getBlendMode() ); - if ( isClipped() ) { + if ( mMode == TextInputMode::Password && isClipped() ) { clipSmartDisable(); } } diff --git a/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languages/typescript.cpp b/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languages/typescript.cpp index 1723d753f..0afbc9b8c 100644 --- a/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languages/typescript.cpp +++ b/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languages/typescript.cpp @@ -11,7 +11,7 @@ SyntaxDefinition& addTypeScript() { ->add( { "TypeScript", - { "%.ts$", "%.d%.ts$", "%.cts$" }, + { "%.ts$", "%.d%.ts$", "%.cts$", "%.mts$" }, { { { "//.-\n" }, "comment" }, { { "/%*", "%*/" }, "comment" },