Basic support for table ansi resets.

This commit is contained in:
Dominik Pantůček 2023-06-15 16:45:35 +02:00
parent 60850f60b0
commit 97dd257780
4 changed files with 18 additions and 10 deletions

View file

@ -177,6 +177,7 @@
(list "" 1 2 3 4 5 6 7 8 9 10 11 12))
(member-calendar->years-table mc))))
(table->string data
#:ansi-reset? #t
#:border '(((light #:top #:left none) (light #:top none) ... (light #:top #:right none))
((light #:left none) light ... (light #:right none)) ...
((light #:bottom #:left none) (light #:bottom none) ... (light #:bottom #:right none)))

View file

@ -143,7 +143,6 @@
(member-payments->table mr)
(member-calendar->table mr))
)
#:ansi #t
#:row0-border #t
#:col-border #t))
(let* ((balance (member-balance mr))

View file

@ -29,6 +29,8 @@
(
table-rows-border
make-table-vertical-sgr-block
table-border-vertical
table-border-between-rows?

View file

@ -89,7 +89,7 @@
(res '())
(prev-borders #f))
(if (null? rows)
(apply append
(let ((res0 (apply append
(reverse (if (table-border-between-rows? prev-borders #f)
(cons (table-rows-border col-widths
prev-borders
@ -97,7 +97,13 @@
col-separators
unicode?)
res)
res)))
res)))))
(if ansi-reset?
(sgr-block-happend res0
(make-table-vertical-sgr-block
(sgr-block-height res0)
"\x1b[0m"))
res0))
(loop (cdr rows)
(cdr borders)
(if (table-border-between-rows? prev-borders (car borders))