mirror of
https://github.com/iyear/tdl
synced 2025-01-09 04:17:35 +08:00
fix(prog): try to fix tracker length resize
This commit is contained in:
parent
94406e9185
commit
2172f40437
@ -14,15 +14,13 @@ func New(formatter progress.UnitsFormatter) progress.Writer {
|
|||||||
pw := progress.NewWriter()
|
pw := progress.NewWriter()
|
||||||
pw.SetAutoStop(false)
|
pw.SetAutoStop(false)
|
||||||
|
|
||||||
width := 50
|
width := 100
|
||||||
if size, err := tsize.GetSize(); err == nil {
|
if size, err := tsize.GetSize(); err == nil {
|
||||||
width = size.Width
|
width = size.Width
|
||||||
}
|
}
|
||||||
if width > 100 {
|
width -= 50 // tail length
|
||||||
width = 100
|
pw.SetTrackerLength(width / 5)
|
||||||
}
|
pw.SetMessageWidth(width * 3 / 5)
|
||||||
pw.SetTrackerLength(width / 3)
|
|
||||||
pw.SetMessageWidth(width * 2 / 3)
|
|
||||||
pw.SetStyle(progress.StyleDefault)
|
pw.SetStyle(progress.StyleDefault)
|
||||||
pw.SetTrackerPosition(progress.PositionRight)
|
pw.SetTrackerPosition(progress.PositionRight)
|
||||||
pw.SetUpdateFrequency(time.Millisecond * 100)
|
pw.SetUpdateFrequency(time.Millisecond * 100)
|
||||||
|
Loading…
Reference in New Issue
Block a user