Skip to content

Commit

Permalink
Optimize full_text setter to skip redundant updates
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham0x13 committed Nov 5, 2024
1 parent 150e713 commit f237d6c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions adafruit_display_text/scrolling_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,10 @@ def full_text(self) -> str:
def full_text(self, new_text: str) -> None:
if new_text and new_text[-1] != " ":
new_text = "{} ".format(new_text)
self._full_text = new_text
self.current_index = 0
self.update(True)
if new_text != self._full_text:
self._full_text = new_text
self.current_index = 0
self.update(True)

@property
def text(self):
Expand Down

0 comments on commit f237d6c

Please sign in to comment.