ansi/box
src/ansi/box.tur
Unicode box-drawing constants and rectangle helpers.
defn
box-tl-single
(box-tl-single)
defn
box-tr-single
(box-tr-single)
defn
box-bl-single
(box-bl-single)
defn
box-br-single
(box-br-single)
defn
box-h-single
(box-h-single)
defn
box-v-single
(box-v-single)
defn
box-tl-double
(box-tl-double)
defn
box-tr-double
(box-tr-double)
defn
box-bl-double
(box-bl-double)
defn
box-br-double
(box-br-double)
defn
box-h-double
(box-h-double)
defn
box-v-double
(box-v-double)
defn
box-tl-round
(box-tl-round)
defn
box-tr-round
(box-tr-round)
defn
box-bl-round
(box-bl-round)
defn
box-br-round
(box-br-round)
defn
box-draw
(box-draw [row :int col :int height :int width :int style :int])
draw a bordered rectangle at (row col) of size height x width.
Parameters
| row, col -- 1-based top-left corner | ||
| height, width -- must be >= 2; a 2x2 box is the smallest meaningful size | ||
| style | 0 = single line, 1 = double line, 2 = round corners | |
| Out-of-range style values are treated as 0. Sizes less than 2 are | ||
| no-ops. |
Since: tur-ansi AN3
defn
box-fill
(box-fill [row :int col :int height :int width :int ch :int])
fill the interior (height-2 x width-2) of a rectangle with ch.
Parameters
| row, col, height, width -- same as box-draw | ||
| ch | ASCII codepoint (32-126). Out-of-range | |
| values fall back to space (32). | ||
| Use box-fill BEFORE box-draw so the border isn't overwritten by the fill. |
defn
box-title
(box-title [row :int col :int width :int title :cstr])
write a title string centered on the top border.
Parameters
| row, col, width -- the box's top-left and width | ||
| title | caption (ASCII byte length used for centering; | |
| truncated with "..." if it doesn't fit in width-4 | ||
| so there is at least one border glyph on each side) | ||
| box-title should be called AFTER box-draw so it overwrites the top | ||
| border with the title text. |