diff --git a/firmware/common/ui_widget.cpp b/firmware/common/ui_widget.cpp index 9b6e5883..1e4dc9c0 100644 --- a/firmware/common/ui_widget.cpp +++ b/firmware/common/ui_widget.cpp @@ -365,9 +365,13 @@ void Text::set(std::string_view value) { void Text::paint(Painter& painter) { const auto rect = screen_rect(); auto s = has_focus() ? style().invert() : style(); + auto max_len = (unsigned)rect.width() / s.font.char_width(); painter.fill_rectangle(rect, s.background); + if (text.length() > max_len) + text.resize(max_len); + painter.draw_string( rect.location(), s,