diff --git a/Applications/Welcome/TextWidget.cpp b/Applications/Welcome/TextWidget.cpp index 070801f4c6..c035ae2de6 100644 --- a/Applications/Welcome/TextWidget.cpp +++ b/Applications/Welcome/TextWidget.cpp @@ -100,13 +100,13 @@ void TextWidget::wrap_and_set_height() if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n') { if (start.has_value()) words.append(m_text.substring(start.value(), i - start.value())); - start = -1; + start.clear(); } else if (!start.has_value()) { start = i; } } if (start.has_value()) - words.append(m_text.substring(start, m_text.length() - start.value())); + words.append(m_text.substring(start.value(), m_text.length() - start.value())); auto rect = frame_inner_rect(); if (frame_thickness() > 0) @@ -122,6 +122,7 @@ void TextWidget::wrap_and_set_height() if (line_width + word_width > rect.width()) { lines.append(builder.to_string()); + builder.clear(); line_width = 0; } diff --git a/Applications/Welcome/TextWidget.h b/Applications/Welcome/TextWidget.h index b237c5ee35..f4c71e8cd5 100644 --- a/Applications/Welcome/TextWidget.h +++ b/Applications/Welcome/TextWidget.h @@ -28,8 +28,8 @@ #include #include -#include #include +#include class TextWidget : public GUI::Frame { C_OBJECT(TextWidget)