Skip to content

Read :border, not the dead :border_style key, when picking box glyphs#527

Merged
DROOdotFOO merged 1 commit into
DROOdotFOO:masterfrom
merklebonsai:pr/rounded-border-corners
Jul 15, 2026
Merged

Read :border, not the dead :border_style key, when picking box glyphs#527
DROOdotFOO merged 1 commit into
DROOdotFOO:masterfrom
merklebonsai:pr/rounded-border-corners

Conversation

@merklebonsai

Copy link
Copy Markdown
Collaborator

`render_clipped_box/5` reads `:border` to decide whether to draw a border.
The very next clause, `render_box_with_border_option/6`, read a different
key -- `:border_style` -- to decide which glyph set. Nothing in the box
pipeline ever sets `:border_style`, so it always fell back to `:single`:
a box declaring `border: :rounded` rendered square corners regardless.

Same shape as the divider background default (#526) and the whole ADR-0029
catalog: two names doing one job, and the wrong one wins silently because
the failure only shows up once you're looking at the actual glyph.

`:border` can also legitimately hold `:bold`/`:dashed` (documented variants
with no glyph set in `BorderRenderer`) -- routed to `:single` rather than
falling through `BorderRenderer`'s own catch-all to `:none`, whose
horizontal run is a space (an invisible border, worse than a square one).

No test asserted a specific square-corner glyph; the two tests that touch
this path (`theme_handling_test.exs`, `demo_render_test.exs`) check
fg/bg/attrs and a regex that already matches both box-drawing sets.

Full suite: 4713/4715 -- the 2 failures are pre-existing env-leak/timing
flakes, present on master, unrelated.

Found, not fixed here (same audit, separate concern): the layout engine
nests a top-level-declared `:border` under `:attrs` (`engine.ex:464`) and
nothing lifts it back into `:style` before render -- a box whose variant is
declared outside the `:style` map renders no border at all. Flagging for a
follow-up.

A box declaring border: :rounded (or :double, :ascii) always rendered
square corners. render_clipped_box checks :border to decide WHETHER
to draw a border; the glyph-selection clause right below it read a
different key, :border_style, to decide WHICH glyph set -- a key
nothing in the codebase ever sets, so it silently fell back to
:single every time.

Same failure class as the divider background default: two names for
one job, and the wrong one wins invisibly on a border that's already
visible, so nobody noticed the corners were wrong shape.

:border can also hold :bold or :dashed (documented variants with no
glyph set in BorderRenderer) or, in principle, a stray value from
somewhere unexpected -- normalize_border_variant/1 routes anything
BorderRenderer doesn't have glyphs for to :single rather than letting
BorderRenderer's own catch-all fall through to :none, whose
horizontal run is a space (an invisible border, worse than a square
one).
@DROOdotFOO
DROOdotFOO merged commit e473b7b into DROOdotFOO:master Jul 15, 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