Split line padding from table cell padding.

This commit is contained in:
Dominik Pantůček 2023-03-28 22:28:51 +02:00
parent 19daaf7706
commit c0a8d6d2b3

View file

@ -136,6 +136,14 @@
rcws)) rcws))
rcws))))) rcws)))))
;; Normalizes cell line to required width and handles leading and
;; trailing tabs to allow for right and center alignment.
(define (table-normalize-cell-line cs w)
(let ((csl (ansi-string-length cs)))
(if (< csl w)
(string-append cs (string-repeat " " (- w csl)))
cs)))
;; Pads all lines of this cell to required width ;; Pads all lines of this cell to required width
(define (table-normalize-cell c w) (define (table-normalize-cell c w)
(let loop ((c c) (let loop ((c c)
@ -143,11 +151,7 @@
(if (null? c) (if (null? c)
(reverse r) (reverse r)
(loop (cdr c) (loop (cdr c)
(cons (let* ((cs (car c)) (cons (table-normalize-cell-line (car c) w)
(csl (ansi-string-length cs)))
(if (< csl w)
(string-append cs (string-repeat " " (- w csl)))
cs))
r))))) r)))))
;; Returns a row (list) of cells (list of strings) with all strings ;; Returns a row (list) of cells (list of strings) with all strings