From 99fac43aa449fb607926c94f153f1c9e02889e01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Pant=C5=AF=C4=8Dek?= Date: Thu, 30 Mar 2023 21:17:46 +0200 Subject: [PATCH] Display progress bars. --- progress.scm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/progress.scm b/progress.scm index 239fc89..c598cbc 100644 --- a/progress.scm +++ b/progress.scm @@ -116,9 +116,17 @@ (* raw-value (- (cdr range) (car range))))) (value% (* 100 value)) - (ivalue% (inexact->exact (round value%)))) + (ivalue% (inexact->exact (round value%))) + (bwidth (inexact->exact + (round + (* value (*progress%-width*))))) + (swidth (- (*progress%-width*) bwidth))) (display - (sprintf "\r[]~A% ~A" ivalue% (*current-progress%*)))))) + (sprintf "\r[~A~A]~A% ~A" + (make-string bwidth #\=) + (make-string swidth #\space) + ivalue% + (*current-progress%*)))))) ;; If the new value is different-enough from the current one, updates ;; it and re-prints the progress%