From 60850f60b0a4d9a4f2a2b406407d6af96ec407e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Pant=C5=AF=C4=8Dek?= Date: Thu, 15 Jun 2023 16:39:13 +0200 Subject: [PATCH] Prepare for ANSI resets. --- src/table-border.scm | 18 +++++++++++------- src/table.scm | 3 ++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/table-border.scm b/src/table-border.scm index 9618633..a7f2318 100644 --- a/src/table-border.scm +++ b/src/table-border.scm @@ -134,17 +134,21 @@ (cdr cws) (cdr col-seps))))))) + ;; Universal block maker + (define (make-table-vertical-sgr-block height str) + (let loop ((height height) + (res '())) + (if (= height 0) + res + (loop (sub1 height) + (cons (list 0 (cons str 1)) + res))))) + ;; Returns a SGR-block of correct height (define* (table-border-vertical height left-borders right-borders (unicode? #t)) (let* ((ch (table-border-char-horizontal left-borders right-borders unicode?)) (str (utf8-char->string ch))) - (let loop ((height height) - (res '())) - (if (= height 0) - res - (loop (sub1 height) - (cons (list 0 (cons str 1)) - res)))))) + (make-table-vertical-sgr-block height str))) ;; Returns true if the border should be drawn between these two rows (define (table-border-between-rows? row0 row1) diff --git a/src/table.scm b/src/table.scm index 2a2a8b3..213892a 100644 --- a/src/table.scm +++ b/src/table.scm @@ -75,7 +75,8 @@ #:border (border-spec '((none ...) ...)) #:widths (widths-spec '(0 ...)) #:width (width #f) - #:unicode? (unicode? (eq? (*table-border-style*) 'unicode))) + #:unicode? (unicode? (eq? (*table-border-style*) 'unicode)) + #:ansi-reset? (ansi-reset? #f)) (let-values (((ptbl col-widths) (table-prepare tbl width widths-spec))) (let* ((num-columns (length (car tbl)))