File tree 1 file changed +9
-8
lines changed
1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ def __init__(
66
66
self ._last_animate_time = - 1
67
67
self .max_characters = max_characters
68
68
69
- if text [- 1 ] != " " :
69
+ if text and text [- 1 ] != " " :
70
70
text = "{} " .format (text )
71
71
self ._full_text = text
72
72
@@ -123,10 +123,10 @@ def current_index(self) -> int:
123
123
124
124
@current_index .setter
125
125
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 :
129
127
self ._current_index = new_index % len (self .full_text )
128
+ else :
129
+ self ._current_index = 0
130
130
131
131
@property
132
132
def full_text (self ) -> str :
@@ -139,11 +139,12 @@ def full_text(self) -> str:
139
139
140
140
@full_text .setter
141
141
def full_text (self , new_text : str ) -> None :
142
- if new_text [- 1 ] != " " :
142
+ if new_text and new_text [- 1 ] != " " :
143
143
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 )
147
148
148
149
@property
149
150
def text (self ):
You can’t perform that action at this time.
0 commit comments