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

@ -155,8 +155,8 @@
;; accordingly.
(define (ansi-paragraph-format str width)
(let* ((strl (string->list str))
(first-char (car strl))
(last-char (car (reverse strl)))
(first-char (if (null? strl) #f (car strl)))
(last-char (if (null? strl) #f (car (reverse strl))))
(first-tab (eq? first-char #\tab))
(last-tab (eq? last-char #\tab)))
(let loop ((words (string-split