diff --git a/internal/system/box.go b/internal/system/box.go index d01d0c5..1b73b8d 100644 --- a/internal/system/box.go +++ b/internal/system/box.go @@ -69,6 +69,7 @@ func (this *System) newBox (outer anyBox) *box { system: this, outer: outer, drawer: outer, + tags: make(util.Set[string]), } box.canvas = util.NewMemo (func () canvas.Canvas { if box.parent == nil { return nil } @@ -614,7 +615,8 @@ func (this *box) propagateAlt (callback func (anyBox) bool) bool { func (this *box) transparent () bool { // TODO uncomment once we have // a way to detect texture transparency - return util.Transparent(this.attrColor.Value()) /*&& + col := this.attrColor.Value().Color + return col == nil || util.Transparent(col) /*&& (this.texture == nil || !this.texture.Opaque())*/ } diff --git a/internal/system/style.go b/internal/system/style.go index df7e46a..9ed4d52 100644 --- a/internal/system/style.go +++ b/internal/system/style.go @@ -11,7 +11,7 @@ type styleApplicator struct { func (this *styleApplicator) apply (box anyBox) { if box.Role() != this.role { // the role has changed, so re-cache the list of rules - this.rules = make([]*tomo.Rule, 4) + this.rules = make([]*tomo.Rule, 0, 4) for _, rule := range this.style.Rules { role := box.Role() // blank fields match anything @@ -27,10 +27,12 @@ func (this *styleApplicator) apply (box anyBox) { attrs := make(tomo.AttrSet) for _, rule := range this.rules { satisifed := true - for _, tag := range rule.Tags { - if !box.Tag(tag) { - satisifed = false - break + if rule.Tags != nil { + for _, tag := range rule.Tags { + if !box.Tag(tag) { + satisifed = false + break + } } }