Handle empty strings in paragraph formatting.

This commit is contained in:
Dominik Pantůček 2023-03-28 22:53:40 +02:00
parent c0a8d6d2b3
commit 624460132b
2 changed files with 8 additions and 4 deletions

View file

@ -138,8 +138,12 @@
;; 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)))
(define (table-normalize-cell-line line w)
(let ((lst (string->list line))
(first-char (if (null? lst) #f (car lst)))
(last-char (if (null? lst) #f (car (reverse lst))))
;; Line without tabs
(len (ansi-string-length line)))
(if (< csl w)
(string-append cs (string-repeat " " (- w csl)))
cs)))