Skip to content

Commit 2399b2b

Browse files
committed
fix: more sensible :margins borders
1 parent f2e6bd9 commit 2399b2b

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

docs/src/layouts/nodes/margins.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ A `:margins` node puts transparent margins around its child allowing the current
2020

2121
These properties set the size of the node inside of the `:margins` node; they do not refer to the width of the margins. A value of 0 for either property means that the node will use the full space available to it in that dimension.
2222

23+
These values do not work like margins do in CSS. A value of `80` for `:cols` means that the `:margins` node will render its contents with a _maximum_ width of 80 columns and center it. The `:border` property below will only render borders if the size of the inner node (after applying `:cols`) is _smaller_ than the size of the `:margins` node.
24+
2325
`:border`
2426

2527
The [border style](#border-styles) for the borders around the node.

pkg/layout/margins/module.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,6 @@ func (l *Margins) getInner(outer geom.Size) geom.Rect {
197197
C: geom.Max(getSize(outer.C, factor.C), 1),
198198
}
199199

200-
if value, ok := l.config.Border.GetPreset(); ok && !value.None() {
201-
inner.C = geom.Max(
202-
inner.C-2,
203-
1,
204-
)
205-
}
206-
207200
return geom.Rect{
208201
Position: outer.Center(inner),
209202
Size: inner,

0 commit comments

Comments
 (0)