Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions blink/internal/reporter/progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ type Progress struct {
mu sync.Mutex
}

// iconFrames is a pulsing bloom that grows from a dot to a star and back, advanced one step per render.
// iconFrames is a pulsing bloom that grows from a dot to a star and back.
var iconFrames = []string{"·", "∘", "○", "◯", "✦", "✧", "✦", "◯", "○", "∘"}

// iconHold keeps each frame on screen for several renders, so the pulse reads
// as a slow bloom instead of a flicker on large file counts.
const iconHold = 5

// NewProgress returns a progress bar; it only draws when w is a terminal.
func NewProgress(w *os.File) *Progress {
p := &Progress{w: w, width: 28}
Expand Down Expand Up @@ -75,7 +79,7 @@ func (p *Progress) render() {
if p.total <= 0 {
return
}
icon := iconFrames[p.frame%len(iconFrames)]
icon := iconFrames[(p.frame/iconHold)%len(iconFrames)]
p.frame++
_, _ = fmt.Fprintf(p.w, "\r %s", icon)
}
Loading