Use new table for listings.

This commit is contained in:
Dominik Pantůček 2023-06-15 15:08:02 +02:00
parent 3e4e8c4672
commit eaced78aee
3 changed files with 6 additions and 5 deletions

View file

@ -105,7 +105,7 @@ testing.o: testing.import.scm
testing.import.scm: $(TESTING-SOURCES) testing.import.scm: $(TESTING-SOURCES)
LISTING-SOURCES=listing.scm testing.import.scm ansi.import.scm \ LISTING-SOURCES=listing.scm testing.import.scm ansi.import.scm \
racket-kwargs.import.scm table-old.import.scm racket-kwargs.import.scm table.import.scm
listing.o: listing.import.scm listing.o: listing.import.scm
listing.import.scm: $(LISTING-SOURCES) listing.import.scm: $(LISTING-SOURCES)

View file

@ -41,7 +41,7 @@
ansi ansi
racket-kwargs racket-kwargs
util-dict-list util-dict-list
table-old) table)
;; Returns the number of digits required to represent a given number ;; Returns the number of digits required to represent a given number
;; in decimal format. ;; in decimal format.
@ -148,7 +148,7 @@
(was-printing #f) (was-printing #f)
(rtbl '())) (rtbl '()))
(if (null? lines) (if (null? lines)
(print (table->string (reverse rtbl) #:ansi #t)) (print (table->string (reverse rtbl)))
(let* ((highlight (match-highlight number highlights)) (let* ((highlight (match-highlight number highlights))
(hl-type (if highlight (cadddr highlight) #f)) (hl-type (if highlight (cadddr highlight) #f))
(hl-def (assq hl-type highlight-rules)) (hl-def (assq hl-type highlight-rules))

View file

@ -183,14 +183,15 @@
;;(_ (print min-widths0)) ;;(_ (print min-widths0))
(min-widths (combine-column-widths min-widths0 widths)) (min-widths (combine-column-widths min-widths0 widths))
;;(_ (print min-widths)) ;;(_ (print min-widths))
(col-weights (table-column-weights ptbl)) (col-weights (table-column-weights ptbl)) ;; Also ideal widths
;;(_ (print col-weights)) ;;(_ (print col-weights))
(min-width (foldl + 0 min-widths)) (min-width (foldl + 0 min-widths))
(max-width (foldl + 0 col-weights))
;;(_ (print min-width)) ;;(_ (print min-width))
(width (if (and width-arg (width (if (and width-arg
(> width-arg min-width)) (> width-arg min-width))
width-arg width-arg
min-width)) max-width))
;;(_ (print width)) ;;(_ (print width))
(width-surplus (- width min-width)) (width-surplus (- width min-width))
;;(_ (print width-surplus)) ;;(_ (print width-surplus))