Fixed a line wrapping issue for text with blank lines that was not displayed in a scrollable container

This commit is contained in:
Leon Styhre 2023-04-08 15:35:56 +02:00
parent fba314ad04
commit 0f3db2fbf1

View file

@ -279,14 +279,18 @@ std::string Font::wrapText(const std::string& text,
std::vector<std::pair<size_t, float>> 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;