Browse files

Fixed logic bug that caused bar to jump one extra space at the end

  • Loading branch information...
1 parent 2b48b1d commit 04025b0441eeef86cc858b9b3e7fef0fa705f2a0 @davglass davglass committed Sep 19, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/node-progress.js
View
4 lib/node-progress.js
@@ -84,12 +84,12 @@ ProgressBar.prototype.tick = function(len, tokens){
var percent = this.curr / this.total * 100
, complete = Math.round(this.width * (this.curr / this.total))
- , incomplete = this.width - complete
+ , incomplete
, elapsed = new Date - this.start
, eta = elapsed * (this.total / this.curr - 1)
complete = Array(complete).join(this.chars.complete);
- incomplete = Array(incomplete).join(this.chars.incomplete);
+ incomplete = Array(this.width - complete.length).join(this.chars.incomplete);
var str = this.fmt
.replace(':bar', complete + incomplete)

0 comments on commit 04025b0

Please sign in to comment.