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

Fix progress bar display when terminal width is too small #133

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vawale
Copy link

@vawale vawale commented Jun 27, 2024

When the terminal width is too small, we run into problems as mentioned in #132. This PR fixes the problem by keeping track of number of wrapped lines printed by progress bar and erasing those extra wrapped lines before printing progress for next iteration.

For multi_progress bar and dynamic_progress bar, we need to move cursor to start before each iteration by summing up number of wrapped lines for each bar. Since each bar's print_progress expects cursor to be on last printed line, we move cursor down by number of wrapped lines before printing progress for each bar.

I have not yet handled case when dynamic_progress option hide_bar_when_complete is set.

Fixes Issue #132

@vawale vawale force-pushed the fix-repeated-lines-for-small-terminal-width branch from 925a5bd to d248ab4 Compare July 2, 2024 15:33
When the terminal width is too small, we run into problems as mentioned
in p-ranav#132. This PR fixes the
problem by keeping track of number of wrapped lines printed by progress
bar and erasing those extra wrapped lines before printing progress for
next iteration.

For multi_progress bar and dynamic_progress bar, we need to move cursor
to start before each iteration by summing up number of wrapped lines for
each bar. Since each bar's `print_progress` expects cursor to be on last
printed line, we move cursor down by number of wrapped lines before
printing progress for each bar.

I have not yet handled case when `dynamic_progress` option
`hide_bar_when_complete` is set.

Fixes Issue p-ranav#132
@vawale vawale force-pushed the fix-repeated-lines-for-small-terminal-width branch from d248ab4 to b06a9c1 Compare July 3, 2024 08:46
`move_down` function on windows actually ended up moving the cursor up.
Fix this bug.
@vawale
Copy link
Author

vawale commented Sep 9, 2024

@p-ranav Can you please take a look at this PR? This solves some of the issues I faced with using indicators.

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

Successfully merging this pull request may close these issues.

1 participant