Finish alignment.
This commit is contained in:
parent
3f50d85412
commit
965b0432fa
4 changed files with 19 additions and 5 deletions
5
ansi.scm
5
ansi.scm
|
@ -127,7 +127,10 @@
|
||||||
;; 1 - seen escape
|
;; 1 - seen escape
|
||||||
;; 2 - CSI started
|
;; 2 - CSI started
|
||||||
(define (ansi-string-length str)
|
(define (ansi-string-length str)
|
||||||
(let loop ((lst (irregex-extract (irregex "." 'u) str))
|
(let loop ((lst (irregex-extract (irregex "." 'u)
|
||||||
|
(irregex-replace (irregex "\t$" 'u)
|
||||||
|
(irregex-replace (irregex "^\t" 'u)
|
||||||
|
str))))
|
||||||
(state 0)
|
(state 0)
|
||||||
(len 0))
|
(len 0))
|
||||||
(if (null? lst)
|
(if (null? lst)
|
||||||
|
|
|
@ -26,6 +26,7 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
")
|
")
|
||||||
|
|
||||||
(import testing
|
(import testing
|
||||||
|
(chicken format)
|
||||||
listing
|
listing
|
||||||
dictionary
|
dictionary
|
||||||
month
|
month
|
||||||
|
@ -136,7 +137,9 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
(let* ((mc (member-calendar mr))
|
(let* ((mc (member-calendar mr))
|
||||||
(fees (member-calendar->fees mc)))
|
(fees (member-calendar->fees mc)))
|
||||||
(print-member-table mr)
|
(print-member-table mr)
|
||||||
(print (table->string (cons (list "" 1 2 3 4 5 6 7 8 9 10 11 12)
|
(print (table->string (cons (map (lambda (c)
|
||||||
|
(sprintf "\t~A\t" c))
|
||||||
|
(list "" 1 2 3 4 5 6 7 8 9 10 11 12))
|
||||||
(member-calendar->years-table mc))
|
(member-calendar->years-table mc))
|
||||||
#:table-border #t
|
#:table-border #t
|
||||||
#:row-border #t
|
#:row-border #t
|
||||||
|
|
|
@ -332,7 +332,7 @@
|
||||||
;; Helper function for pretty-formatting the filtered members lists
|
;; Helper function for pretty-formatting the filtered members lists
|
||||||
;; in a table.
|
;; in a table.
|
||||||
(define (members-table-row a:? label mrs fmt)
|
(define (members-table-row a:? label mrs fmt)
|
||||||
(list (string-append a:? label)
|
(list (string-append "\t" a:? label)
|
||||||
(length mrs)
|
(length mrs)
|
||||||
(ansi-paragraph-format
|
(ansi-paragraph-format
|
||||||
(member-records->string
|
(member-records->string
|
||||||
|
|
12
table.scm
12
table.scm
|
@ -150,8 +150,16 @@
|
||||||
(if (< len w)
|
(if (< len w)
|
||||||
(let* ((miss (- w len))
|
(let* ((miss (- w len))
|
||||||
(do-left-pad first-tab)
|
(do-left-pad first-tab)
|
||||||
(do-right-pad (or (not first-tab) last-tab)))
|
(do-right-pad (or (not first-tab) last-tab))
|
||||||
(string-append line1 (string-repeat " " miss)))
|
(left-pad-len (if do-left-pad
|
||||||
|
(if do-right-pad
|
||||||
|
(- miss (quotient miss 2))
|
||||||
|
miss)
|
||||||
|
0))
|
||||||
|
(right-pad-len (- miss left-pad-len))
|
||||||
|
(left-pad (make-string left-pad-len #\space))
|
||||||
|
(right-pad (make-string right-pad-len #\space)))
|
||||||
|
(string-append left-pad line1 right-pad))
|
||||||
line1)))
|
line1)))
|
||||||
|
|
||||||
;; Pads all lines of this cell to required width
|
;; Pads all lines of this cell to required width
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue