Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Crash when using an animation and switching to a new animated message shorter than current position #162

Open
Nemo157 opened this issue Aug 9, 2021 · 0 comments

Comments

@Nemo157
Copy link

Nemo157 commented Aug 9, 2021

Description

If you set a message to be rendered using one of the animations, then stop it and change to a different message which is shorter than the original message but still needs animating, if the current index is longer than the new message an exception is thrown

System settings

  • Operating System: Arch Linux
  • Terminal in use: Alacritty
  • Python version: 3.9
  • Halo version: 0.0.31
  • pip freeze output:
halo==0.0.31
log-symbols==0.0.14
six==1.16.0
spinners==0.0.24
termcolor==1.1.0

Error

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 973, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.9/threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File ".../lib/python3.9/site-packages/halo/halo.py", line 421, in render
    self._render_frame()
  File ".../lib/python3.9/site-packages/halo/halo.py", line 407, in _render_frame
    frame = self.frame()
  File ".../lib/python3.9/site-packages/halo/halo.py", line 441, in frame
    text_frame = self.text_frame()
  File ".../lib/python3.9/site-packages/halo/halo.py", line 464, in text_frame
    frame = frames[self._text_index]
IndexError: list index out of range

Expected behaviour

Reset _text_index to the start of the new message.

Steps to recreate

> python -c "import halo;halo=halo.Halo(animation='marquee',interval=1);halo.start('abc'*$COLUMNS);import time;time.sleep($COLUMNS*0.01*2);halo.start('x'*($COLUMNS+2))"

(not 100% reliable, can take a few tries to reproduce)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant