Use non-breaking spaces for alignment.

This commit is contained in:
Dominik Pantůček 2023-06-15 22:42:39 +02:00
parent cc9e5bad7d
commit f1c3ec70a3
6 changed files with 36 additions and 25 deletions

View file

@ -49,7 +49,8 @@
racket-kwargs
sgr-state
sgr-list
testing)
testing
util-utf8)
;; Converts sgr-list (possibly containing multiple lines) into a
;; sgr-block
@ -101,7 +102,7 @@
;; Creates filler for justification of SGR lines
(define (make-sgr-list-filler n)
(cons (make-string n #\space) n))
(cons (make-utf8-string n #\xA0) n))
;; If first or last non-sgr-state token is space, removes it,
;; converts all spaces to glues. Removes unglue.
@ -172,14 +173,14 @@
(if (sgr-token-glue? tk)
(loop (cdr gluelens)
(cdr sl)
(cons (cons (make-string (car gluelens))
(cons (cons (make-utf8-string (car gluelens) #\xA0)
(car gluelens))
res))
(loop gluelens
(cdr sl)
(cons (car sl) res))))))
;; Nothing to expand, fill-in remainder with spaces
(reverse (cons (cons (make-string rem0) rem0)
(reverse (cons (cons (make-utf8-string rem0 #\xA0) rem0)
(reverse sl)))))
;; Nowhere to expand
sl)))
@ -361,8 +362,9 @@
(list '())
slw))
state)))
(let-values (((sln) (sgr-list-neutralize sl)))
(values sln initial-state))))
(let ((sln (sgr-list-neutralize sl)))
;;(write sln)(newline)
(values (list sln) initial-state))))
;; Renders all the lines and appends the resulting blocks
(define* (sgr-block-render sb
@ -419,7 +421,7 @@
0
(sgr-list-last-state (car rsb))))
(filler (list state
(cons (make-string sbw)
(cons (make-utf8-string sbw #\xA0)
sbw))))
(let loop ((rsb rsb)
(rh (- h sbh)))