mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
refactor: Move charset test to separate method in Spinner class
This commit is contained in:
parent
3016d7b8f3
commit
73205b1f8c
1 changed files with 6 additions and 0 deletions
|
@ -277,7 +277,12 @@ class Spinner:
|
|||
self.last_update = 0
|
||||
self.visible = False
|
||||
self.is_tty = sys.stdout.isatty()
|
||||
self.tested = False
|
||||
|
||||
def test_charset(self):
|
||||
if self.tested:
|
||||
return
|
||||
self.tested = True
|
||||
# Try unicode first, fall back to ascii if needed
|
||||
try:
|
||||
# Test if we can print unicode characters
|
||||
|
@ -303,6 +308,7 @@ class Spinner:
|
|||
if not self.visible:
|
||||
return
|
||||
|
||||
self.test_charset()
|
||||
print(f"\r{self.text} {next(self.spinner_chars)}\r{self.text} ", end="", flush=True)
|
||||
|
||||
def end(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue