Prepare for ANSI resets.

This commit is contained in:
Dominik Pantůček 2023-06-15 16:39:13 +02:00
parent 0806be2420
commit 60850f60b0
2 changed files with 13 additions and 8 deletions

View file

@ -134,17 +134,21 @@
(cdr cws)
(cdr col-seps)))))))
;; 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)))
;; 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))))))
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)))
(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)

View file

@ -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)))