diff options
author | Tulir Asokan <tulir@maunium.net> | 2019-04-10 22:59:37 +0300 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2019-04-10 22:59:37 +0300 |
commit | abd21affc42ad65968c946c3bbd6c63eba342981 (patch) | |
tree | 5b39b67b64ef5f1c800cbb06821e7d9d4b0433d5 | |
parent | a9199dd9f2fa4b79a3c8b16d2cd46446651fdb81 (diff) |
Fix code block rendering
-rw-r--r-- | ui/messages/html/codeblock.go | 2 | ||||
-rw-r--r-- | ui/messages/html/text.go | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/ui/messages/html/codeblock.go b/ui/messages/html/codeblock.go index 7f6b462..aee2bb4 100644 --- a/ui/messages/html/codeblock.go +++ b/ui/messages/html/codeblock.go @@ -48,7 +48,7 @@ func (ce *CodeBlockEntity) Clone() Entity { func (ce *CodeBlockEntity) Draw(screen mauview.Screen) { screen.Fill(' ', ce.Background) - ce.BaseEntity.Draw(screen) + ce.ContainerEntity.Draw(screen) } func (ce *CodeBlockEntity) AdjustStyle(fn AdjustStyleFunc) Entity { diff --git a/ui/messages/html/text.go b/ui/messages/html/text.go index b168994..ea8f737 100644 --- a/ui/messages/html/text.go +++ b/ui/messages/html/text.go @@ -70,6 +70,10 @@ func (te *TextEntity) Draw(screen mauview.Screen) { func (te *TextEntity) CalculateBuffer(width, startX int, bare bool) int { te.BaseEntity.CalculateBuffer(width, startX, bare) + if len(te.Text) == 0 { + return te.startX + } + te.height = 0 te.prevWidth = width if te.buffer == nil { te.buffer = []string{} |