progressbar
progressbar copied to clipboard
Feature scrolling detail
This pr is created to resolve https://github.com/schollz/progressbar/issues/176.
You can using this new feature like this:
package main
import (
"fmt"
"github.com/schollz/progressbar/v3"
"time"
)
func main(){
bar := progressbar.NewOptions(100,progressbar.OptionSetMaxDetailRow(10))
for i:=1;i<=100;i++{
bar.AddDetail(fmt.Sprint("processing... ",i))
if i%10==0{
bar.Add(10)
}
time.Sleep(100*time.Millisecond)
}
}
output would be:
in the end:
I use ANSI to solve this problem,which makes it easy for me to control the cursor of terminal. I avoid make the progressbar and detail a whole string to update the detail though it may cause difficulties. According to my own experience, the detail of progress has the update frequency which is much higher then progress bar. So it is better to make the detail update independently.
It works well when the maxDetailRow was set to a value smaller than the height of terminal. I am not sure whether it is needed to provide some function for users to get the max maxDetailRow they can set according to their operate system and the terminal they use.If it is needed, I will be glad to do further development for it.
English is not my mother language, so my writing might be weried. I can explain for anything of this pr if you ask me. Thank you for your patient and dedication.🫶