Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
reader: draw last update even if we didn't draw before.
Browse files Browse the repository at this point in the history
If you're doing a small read, it can happen that we reach EOF before we
draw for the first time so outputting the final draw without a prior
draw makes sense.
  • Loading branch information
iaguis committed Apr 30, 2015
1 parent 44efc4c commit d5dc915
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,15 @@ func (r *Reader) drawProgress() {
}

func (r *Reader) finishProgress() {
// Only output the final draw if we drawed prior
if !r.lastDraw.IsZero() {
f := r.drawFunc()
f(r.progress, r.Size)
f := r.drawFunc()
f(r.progress, r.Size)

// Print a newline
f(-1, -1)
// Print a newline
f(-1, -1)

// Reset lastDraw so we don't finish again
var zeroDraw time.Time
r.lastDraw = zeroDraw
}
// Reset lastDraw so we don't finish again
var zeroDraw time.Time
r.lastDraw = zeroDraw
}

func (r *Reader) initProgress() {
Expand Down

0 comments on commit d5dc915

Please sign in to comment.