Fix code block rendering

This commit is contained in:
Tulir Asokan 2019-04-10 22:59:37 +03:00
parent a9199dd9f2
commit abd21affc4
2 changed files with 5 additions and 1 deletions

View File

@ -48,7 +48,7 @@ func (ce *CodeBlockEntity) Clone() Entity {
func (ce *CodeBlockEntity) Draw(screen mauview.Screen) { func (ce *CodeBlockEntity) Draw(screen mauview.Screen) {
screen.Fill(' ', ce.Background) screen.Fill(' ', ce.Background)
ce.BaseEntity.Draw(screen) ce.ContainerEntity.Draw(screen)
} }
func (ce *CodeBlockEntity) AdjustStyle(fn AdjustStyleFunc) Entity { func (ce *CodeBlockEntity) AdjustStyle(fn AdjustStyleFunc) Entity {

View File

@ -70,6 +70,10 @@ func (te *TextEntity) Draw(screen mauview.Screen) {
func (te *TextEntity) CalculateBuffer(width, startX int, bare bool) int { func (te *TextEntity) CalculateBuffer(width, startX int, bare bool) int {
te.BaseEntity.CalculateBuffer(width, startX, bare) te.BaseEntity.CalculateBuffer(width, startX, bare)
if len(te.Text) == 0 {
return te.startX
}
te.height = 0
te.prevWidth = width te.prevWidth = width
if te.buffer == nil { if te.buffer == nil {
te.buffer = []string{} te.buffer = []string{}