Skip to content

Commit

Permalink
re-exports from unicode-diagram into cl-quil.tools
Browse files Browse the repository at this point in the history
printing correction
  • Loading branch information
macrologist committed Apr 1, 2024
1 parent 176f231 commit 3ca6648
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
11 changes: 9 additions & 2 deletions src/tools/package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
(defpackage #:cl-quil.tools
(:nicknames #:tools)
(:use #:cl)
(:import-from #:cl-quil.tools.unicode-diagram #:print-program-diagram)
(:import-from #:cl-quil.tools.unicode-diagram
#:print-program-diagram
#:make-charmap
#:+ascii-charmap+
#:+box-drawings-charmap+)
#+(or sbcl ecl ccl)
(:local-nicknames (:a :alexandria))

Expand All @@ -26,4 +30,7 @@

;; unicode-digram.lisp
(:export
#:print-program-diagram))
#:print-program-diagram
#:make-charmap
#:+ascii-charmap+
#:+box-drawings-charmap+))
6 changes: 4 additions & 2 deletions src/tools/unicode-diagram.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -444,14 +444,16 @@ instances."
(loop
:with centers := (loop :for col :in columns :collect (column-middle col))
:for figure :across row
:for namewidth := (length (figure-name figure))
:when (figure-boxed? figure)
:do (multiple-value-bind (left right) (box-bounds figure columns gap)
(clear-line line :from left :below right)
(setf (elt line left) (vertical)
(elt line right) (vertical))
(replace line (figure-name figure)
:start1 (- (+ left (floor (- right left) 2))
(floor (length (figure-name figure)) 2))))))
:start1 (- (+ left (mod (1+ namewidth) 2) ; even namewidths need an offset
(floor (- right left) 2))
(floor namewidth 2))))))

(defun write-row-content (columns row line)
"The row content line is drawn."
Expand Down

0 comments on commit 3ca6648

Please sign in to comment.