Skip to content

ProgressBarOrSpinner - spinner creates newlines in terminal when msg is longer then terminal width #11556

Closed

Description

@Knusper

Description

astropy.utils.console.ProgressBarOrSpinner is used to create a Spinner with a message, where the message is longer then the width of the terminal e.g.
I set xterm to width 80 and run the following python script

string = '12345678'*11
from astropy.utils.console import ProgressBarOrSpinner
with ProgressBarOrSpinner(None,string, "green") as s:
         for item in  range(100000):
             s.update(1)

Expected behavior

The line is printed only once (wrapped around the terminal edges) and the spinner is rotating.

Actual behavior

Every spinner update spans a new line.

The behaviour was also reported during a discussion in an astroquery bug (in this particular case the lines will be very long and a Spinner is displayed as the archive from which the files are fetched are of unknown size):
astropy/astroquery#1357 (comment)

System Details

Linux-4.19.0-16-amd64-x86_64-with-debian-10.9
Python 3.6.13 |Anaconda, Inc.| (default, Feb 23 2021, 21:15:04)
[GCC 7.3.0]
Numpy 1.19.2
astropy 4.0.2
Scipy 1.5.2
Matplotlib 3.3.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions