From 0f3db2fbf1c6e3bcfd9e1c988e5712de1d404d82 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 8 Apr 2023 15:35:56 +0200 Subject: [PATCH] Fixed a line wrapping issue for text with blank lines that was not displayed in a scrollable container --- es-core/src/resources/Font.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/es-core/src/resources/Font.cpp b/es-core/src/resources/Font.cpp index f1ecf5652..6ef1a0057 100644 --- a/es-core/src/resources/Font.cpp +++ b/es-core/src/resources/Font.cpp @@ -279,14 +279,18 @@ std::string Font::wrapText(const std::string& text, std::vector> dotsSection; bool addDots {false}; - for (size_t i = 0; i < text.length(); ++i) { + for (size_t i {0}; i < text.length(); ++i) { if (text[i] == '\n') { if (!multiLine) { addDots = true; break; } - wrappedText.append("\n"); accumHeight += lineHeight; + if (maxHeight != 0.0f && accumHeight > maxHeight) { + addDots = true; + break; + } + wrappedText.append("\n"); lineWidth = 0.0f; lastSpace = 0; continue;