progress: Rename 'erase-in-line' to 'erase-current-line'.

Suggested by Danny Milosavljevic <dannym@scratchpost.org>.

* guix/progress.scm (erase-in-line): Rename to...
(erase-current-line): ... this.  Adjust callers.
This commit is contained in:
Ludovic Courtès 2017-12-15 10:47:01 +01:00
parent e224820386
commit 3e0a42973b
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 6 additions and 6 deletions

View File

@ -178,8 +178,8 @@ width of the bar is BAR-WIDTH."
(make-string filled #\#) (make-string filled #\#)
(make-string empty #\space)))) (make-string empty #\space))))
(define (erase-in-line port) (define (erase-current-line port)
"Write an ANSI erase-in-line sequence to PORT to erase the whole line and "Write an ANSI erase-current-line sequence to PORT to erase the whole line and
move the cursor to the beginning of the line." move the cursor to the beginning of the line."
(display "\r\x1b[K" port)) (display "\r\x1b[K" port))
@ -206,7 +206,7 @@ ABBREVIATION used to shorten FILE for display."
(byte-count->string throughput) (byte-count->string throughput)
(seconds->string elapsed) (seconds->string elapsed)
(progress-bar %) %))) (progress-bar %) %)))
(erase-in-line log-port) (erase-current-line log-port)
(display (string-pad-middle left right (display (string-pad-middle left right
(current-terminal-columns)) (current-terminal-columns))
log-port) log-port)
@ -218,7 +218,7 @@ ABBREVIATION used to shorten FILE for display."
(byte-count->string throughput) (byte-count->string throughput)
(seconds->string elapsed) (seconds->string elapsed)
(byte-count->string transferred)))) (byte-count->string transferred))))
(erase-in-line log-port) (erase-current-line log-port)
(display (string-pad-middle left right (display (string-pad-middle left right
(current-terminal-columns)) (current-terminal-columns))
log-port) log-port)
@ -248,7 +248,7 @@ tasks is performed. Write PREFIX at the beginning of the line."
(set! done (+ 1 done)) (set! done (+ 1 done))
(unless (> done total) (unless (> done total)
(let* ((ratio (* 100. (/ done total)))) (let* ((ratio (* 100. (/ done total))))
(erase-in-line port) (erase-current-line port)
(if (string-null? prefix) (if (string-null? prefix)
(display (progress-bar ratio (current-terminal-columns)) port) (display (progress-bar ratio (current-terminal-columns)) port)
(let ((width (- (current-terminal-columns) (let ((width (- (current-terminal-columns)
@ -263,7 +263,7 @@ tasks is performed. Write PREFIX at the beginning of the line."
(set! done 0))) (set! done 0)))
(report report-progress) (report report-progress)
(stop (lambda () (stop (lambda ()
(erase-in-line port) (erase-current-line port)
(unless (string-null? prefix) (unless (string-null? prefix)
(display prefix port) (display prefix port)
(newline port)) (newline port))