Skip to content

Draw dividers with box-drawing, from the same charset as borders#515

Merged
DROOdotFOO merged 3 commits into
DROOdotFOO:masterfrom
merklebonsai:pr/divider-box-drawing
Jul 13, 2026
Merged

Draw dividers with box-drawing, from the same charset as borders#515
DROOdotFOO merged 3 commits into
DROOdotFOO:masterfrom
merklebonsai:pr/divider-box-drawing

Conversation

@merklebonsai

Copy link
Copy Markdown
Collaborator

divider/1 defaulted to an ASCII hyphen, so every divider in the playground renders as ----------- sitting right next to properly-drawn ┌────┐ borders. It reads as unfinished, and it was — the boxes got the box-drawing treatment and the divider never did.

A divider is a border's horizontal run, so it should draw from the same charset rather than inventing its own:

variant char matches
:single (default) :single border
:double :double border
:rounded :rounded border
:ascii - :ascii border
:none :none border

An explicit char: still wins, so callers can draw a divider out of anything.

Guard worth calling out: unknown variants resolve to :single instead of being passed straight to BorderRenderer, whose catch-all maps anything unrecognised to :none — and :none's horizontal run is a space. Without the guard, variant: :heavy (or any typo) would silently render an invisible divider.

Also fixes the engine's own fallback (engine.ex, for :divider elements built by hand rather than via the DSL), which had the same hyphen default.

Tests: default matches BorderRenderer.get_border_chars(:single).horizontal by construction; every variant matches its border; unknown variants draw :single, never blank; explicit char: wins. 4/4. Wider sweep (ui + cross_terminal + playground + renderer): 1795/1795 — nothing pinned the old hyphen.

merklebonsai and others added 2 commits July 14, 2026 00:00
`divider/1` defaulted to an ASCII hyphen, so every divider rendered as
`-----------` next to properly-drawn `┌────┐` borders.

A divider is a border's horizontal run, so draw it from the same charset:
`variant: :single` now matches a `:single` border exactly (─), `:double` gives
═, `:ascii` keeps -. An explicit `char:` still wins.

Unknown variants resolve to `:single` rather than being passed through to
BorderRenderer, whose catch-all maps anything unrecognised to `:none` -- whose
horizontal run is a space, so a typo would have silently rendered an invisible
divider.
@DROOdotFOO
DROOdotFOO merged commit 2fea5b2 into DROOdotFOO:master Jul 13, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants