Skip to content

Commit a913137

Browse files
committed
use _full_text in TextBox & put back to empty string after super init.
1 parent 290e5cb commit a913137

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

adafruit_display_text/text_box.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,24 @@ def __init__(
9494
font,
9595
)
9696

97-
if not kwargs.get("text", ""):
97+
text_empty = False
98+
if kwargs.get("text", "") == "":
99+
text_empty = True
98100
kwargs["text"] = " "
99101

100102
super().__init__(font, **kwargs)
101103

102-
self._text = "\n".join(self.lines)
103-
self._text = self._replace_tabs(self._text)
104-
self._original_text = self._text
104+
if text_empty:
105+
self._full_text = ""
106+
107+
self._full_text = "\n".join(self.lines)
108+
self._full_text = self._replace_tabs(self._full_text)
109+
self._original_text = self._full_text
105110

106111
# call the text updater with all the arguments.
107112
self._reset_text(
108113
font=font,
109-
text=self._text,
114+
text=self._full_text,
110115
line_spacing=self._line_spacing,
111116
scale=self.scale,
112117
)

0 commit comments

Comments
 (0)