From bdc418e3343874cceb4cb6361551b7840eab0aa6 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sun, 8 Dec 2019 16:47:11 +0100 Subject: [PATCH] Parent of the first block has an empty style --- blockstack.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/blockstack.go b/blockstack.go index 8393eec..502763c 100644 --- a/blockstack.go +++ b/blockstack.go @@ -63,8 +63,10 @@ func (s BlockStack) Width(ctx RenderContext) uint { } func (s BlockStack) Parent() BlockElement { - if len(s) < 2 { - return s.Current() + if len(s) == 1 { + return BlockElement{ + Block: &bytes.Buffer{}, + } } return s[len(s)-2]