From e1cf524c576cf7d54354e27520a456425c2e3d1a Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Sun, 11 Aug 2024 11:55:13 -0400 Subject: [PATCH] TextBox tries to get a type face when parented if its face is nil --- internal/system/textbox.go | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/internal/system/textbox.go b/internal/system/textbox.go index 9c5d8f7..0ccb8bd 100644 --- a/internal/system/textbox.go +++ b/internal/system/textbox.go @@ -493,9 +493,9 @@ func (this *textBox) scrollToDot () { func (this *textBox) handleFaceChange () { hierarchy := this.getHierarchy() - if hierarchy != nil { return } + if hierarchy == nil { return } faceSet := hierarchy.getFaceSet() - if faceSet != nil { return } + if faceSet == nil { return } face := faceSet.Face(tomo.Face(this.attrFace.Value())) this.face.Set(face, face) @@ -503,3 +503,23 @@ func (this *textBox) handleFaceChange () { this.invalidateMinimum() this.invalidateLayout() } + +func (this *textBox) recursiveReApply () { + this.box.recursiveReApply() + + hierarchy := this.getHierarchy() + if hierarchy == nil { return } + + previousFace := this.face.Value() + if previousFace == nil { + faceSet := hierarchy.getFaceSet() + if faceSet == nil { return } + face := faceSet.Face(tomo.Face(this.attrFace.Value())) + if face != previousFace { + this.face.Set(face, face) + this.drawer.SetFace(face) + this.invalidateMinimum() + this.invalidateLayout() + } + } +}