-
Notifications
You must be signed in to change notification settings - Fork 245
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
MultiProgress: should prune leading progress bars that have become DoneVisible
or DoneHidden
#426
Comments
This sounds reasonable. I don't have a deep understanding of |
chris-laplante
added a commit
to chris-laplante/indicatif
that referenced
this issue
May 26, 2022
This extra layer of abstraction will be necessary to fix console-rs#426
chris-laplante
added a commit
to chris-laplante/indicatif
that referenced
this issue
May 26, 2022
This extra layer of abstraction will be necessary to fix console-rs#426
chris-laplante
added a commit
to chris-laplante/indicatif
that referenced
this issue
May 27, 2022
chris-laplante
added a commit
to chris-laplante/indicatif
that referenced
this issue
May 27, 2022
chris-laplante
added a commit
to chris-laplante/indicatif
that referenced
this issue
May 27, 2022
chris-laplante
added a commit
to chris-laplante/indicatif
that referenced
this issue
May 27, 2022
chris-laplante
added a commit
to chris-laplante/indicatif
that referenced
this issue
May 27, 2022
chris-laplante
added a commit
to chris-laplante/indicatif
that referenced
this issue
May 27, 2022
chris-laplante
added a commit
to chris-laplante/indicatif
that referenced
this issue
Jun 10, 2022
chris-laplante
added a commit
to chris-laplante/indicatif
that referenced
this issue
Jun 10, 2022
chris-laplante
added a commit
to chris-laplante/indicatif
that referenced
this issue
Jun 13, 2022
chris-laplante
added a commit
to chris-laplante/indicatif
that referenced
this issue
Jun 13, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Consider this small example program:
It creates one more spinner that there are lines in the terminal. Here is a video of it running:
Screencast.2022-05-03.13.29.03.mp4
Since we never call
MultiProgress::remove
onProgressBar
s that are dropped/finished (see #419), bars are always redrawn even when they don't need to be. When the number of bars (n) becomes greater than terminal lines (m), on each drawMultiProgress
will clear the last m lines but write n lines, leaving m - n lines in the scrollback history.I propose the following algorithm. On each
MultiProgress:draw
, iterate over the bars in order (according toMultiState::ordering
) andtake_while(|bar| bar.is_finished())
. This set of leading progress bars is then pruned by callingMultiProgress:remove
on each one. This ensures we are not re-drawing bars that don't need to be redrawn and that we are some reclaiming memory.The wrinkle is that
MultiState
cannot currently get at theProgressState
to checkis_finished()
, so we will need to restructure some code.The text was updated successfully, but these errors were encountered: