From dfaf59f93b0ddd77bb3c499c65b3404187a8740e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 9 Apr 2019 23:31:54 +0200 Subject: Add slightly better terminal drawing procedures. --- module/main.scm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/module/main.scm b/module/main.scm index e7766b8e..909bac15 100755 --- a/module/main.scm +++ b/module/main.scm @@ -41,6 +41,13 @@ (define (now) (date->time-utc (current-date))) +(define (box-top intersection line . lengths) + (reduce (lambda (str done) (string-append done (string intersection) str)) + "" (map (cut make-string <> line) lengths))) + +(define (displayln a) + (display a) (newline)) + (define (summary-filter _ str) str) (define (main-loop regular-events repeating-events) @@ -64,11 +71,7 @@ (cls) (display-calendar-header! (time-utc->date time)) ;; (line) - (format #t "~a┬~a┬~a~%" - (make-string 20 #\─) - (make-string 32 #\─) - (make-string 10 #\─)) - + (displayln (box-top #\┬ #\─ 20 32 10)) (for-each (lambda (ev i) @@ -85,10 +88,7 @@ events (iota (length events))) - (format #t "~a┴~a┴~a~%" - (make-string 20 #\─) - (make-string 32 #\─) - (make-string 10 #\─)) + (displayln (box-top #\┴ #\─ 20 32 10)) (unless (null? events) (let ((ev (list-ref events cur-event))) -- cgit v1.2.3