rsalmei / alive-progress

A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bar.text() breaks when inserting different lenght of strings

sergargar opened this issue · comments

The bar.text() breaks when inserting different length of strings:
Screenshot 2023-03-02 at 16 24 36
It should be ap-south-east-1
Screenshot 2023-03-02 at 16 24 41
It should be ap-south-1

It doesn't break, there isn't any bug in texts that I know of. Look:

Screen.Recording.2023-03-02.at.12.47.13.mov

Here is the code, if you'd like to try in your terminal:

with alive_bar(1000) as bar:
    for i in range(1000):
        time.sleep(.01)
        bar()
        if i // 100 % 2 == 0:
            bar.text = f'A long text, that could take your whole line! {i}'
        else:
            bar.text = f'short text {i}'

In my case, I also use a dynamic bar.title, I think that is the issue.

Just for completeness, dynamic titles work too:

Screen.Recording.2023-03-03.at.22.03.01.mov

And even both at the same time!!

Screen.Recording.2023-03-03.at.22.07.01.mov

That's it, man, there isn't any bug in these mechanisms.