Skip to content

Commit dba799f

Browse files
authored
Don't add "..." to every label
The actual length of the text was not tested in set_text, the mere existence of `maxlen` was enough to shorten the string, or add `"..."` if the string was shorter than `maxlen - 3`.
1 parent 9d18093 commit dba799f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

adafruit_portalbase/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@ def set_text(self, val, index=0):
224224
if not self._text:
225225
self.add_text()
226226
string = str(val)
227-
if self._text[index]["maxlen"]:
227+
if self._text[index]["maxlen"] and len(string) > self._text[index]["maxlen"]:
228+
# too long! shorten it
228229
if len(string) >= 3:
229-
# too long! shorten it
230230
string = string[: self._text[index]["maxlen"] - 3] + "..."
231231
else:
232232
string = string[: self._text[index]["maxlen"]]

0 commit comments

Comments
 (0)