mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
feat: Continue spinner animation across instances
This commit is contained in:
parent
b236e0c801
commit
9ef506dc25
1 changed files with 4 additions and 1 deletions
|
@ -258,6 +258,8 @@ class Spinner:
|
||||||
cannot display unicode the frames are converted to plain ASCII.
|
cannot display unicode the frames are converted to plain ASCII.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
last_frame_idx = 0 # Class variable to store the last frame index
|
||||||
|
|
||||||
def __init__(self, text: str, width: int = 7):
|
def __init__(self, text: str, width: int = 7):
|
||||||
self.text = text
|
self.text = text
|
||||||
self.start_time = time.time()
|
self.start_time = time.time()
|
||||||
|
@ -292,7 +294,7 @@ class Spinner:
|
||||||
|
|
||||||
# Bounce the scanner back and forth.
|
# Bounce the scanner back and forth.
|
||||||
self.frames = frames
|
self.frames = frames
|
||||||
self.frame_idx = 0
|
self.frame_idx = Spinner.last_frame_idx # Initialize from class variable
|
||||||
self.scan_char = scan_char
|
self.scan_char = scan_char
|
||||||
self.width = len(frames[0]) - 2 # number of chars between the brackets
|
self.width = len(frames[0]) - 2 # number of chars between the brackets
|
||||||
self.animation_len = len(frames[0])
|
self.animation_len = len(frames[0])
|
||||||
|
@ -312,6 +314,7 @@ class Spinner:
|
||||||
def _next_frame(self) -> str:
|
def _next_frame(self) -> str:
|
||||||
frame = self.frames[self.frame_idx]
|
frame = self.frames[self.frame_idx]
|
||||||
self.frame_idx = (self.frame_idx + 1) % len(self.frames)
|
self.frame_idx = (self.frame_idx + 1) % len(self.frames)
|
||||||
|
Spinner.last_frame_idx = self.frame_idx # Update class variable
|
||||||
return frame
|
return frame
|
||||||
|
|
||||||
def step(self) -> None:
|
def step(self) -> None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue