ui: fix label text eliding to account for icon width (#36539)

fix label text eliding to account for icon width
pull/36553/head
Dean Lee 7 days ago committed by GitHub
parent 1c0b087105
commit 9ce9920ff7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      system/ui/widgets/label.py

@ -145,6 +145,8 @@ class Label(Widget):
# Elide text to fit within the rectangle
text_size = measure_text_cached(self._font, text, self._font_size)
content_width = self._rect.width - self._text_padding * 2
if self._icon:
content_width -= self._icon.width + ICON_PADDING
if text_size.x > content_width:
_ellipsis = "..."
left, right = 0, len(text)

Loading…
Cancel
Save