File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ def __init__(
6666 self ._last_animate_time = - 1
6767 self .max_characters = max_characters
6868
69- if text [- 1 ] != " " :
69+ if text and text [- 1 ] != " " :
7070 text = "{} " .format (text )
7171 self ._full_text = text
7272
@@ -123,10 +123,10 @@ def current_index(self) -> int:
123123
124124 @current_index .setter
125125 def current_index (self , new_index : int ) -> None :
126- if new_index < len (self .full_text ):
127- self ._current_index = new_index
128- else :
126+ if self .full_text :
129127 self ._current_index = new_index % len (self .full_text )
128+ else :
129+ self ._current_index = 0
130130
131131 @property
132132 def full_text (self ) -> str :
@@ -139,11 +139,12 @@ def full_text(self) -> str:
139139
140140 @full_text .setter
141141 def full_text (self , new_text : str ) -> None :
142- if new_text [- 1 ] != " " :
142+ if new_text and new_text [- 1 ] != " " :
143143 new_text = "{} " .format (new_text )
144- self ._full_text = new_text
145- self .current_index = 0
146- self .update ()
144+ if new_text != self ._full_text :
145+ self ._full_text = new_text
146+ self .current_index = 0
147+ self .update (True )
147148
148149 @property
149150 def text (self ):
You can’t perform that action at this time.
0 commit comments