bug fix but still a new one :(

This commit is contained in:
2024-09-26 23:03:17 +02:00
parent 3b3e92fae5
commit 4214f96c61
8 changed files with 108 additions and 66 deletions
+11 -6
View File
@@ -44,7 +44,7 @@ func (d *DivComponent) Render() string {
osui.RenderOnFrame(c, &frame)
}
for i, f := range frame {
frame[i] = colors.Combine(d.Style.Foreground, d.Style.Background) + f + d.Data.DefaultColor
frame[i] = colors.Reset + d.Data.DefaultColor + colors.Combine(d.Style.Foreground, d.Style.Background) + f + colors.Reset + d.Data.DefaultColor
}
return strings.Join(frame, "\n")
}
@@ -73,17 +73,22 @@ func (d *DivComponent) Update(key string) bool {
if len(d.Components) > 0 {
d.Components[d.ActiveComponent].GetComponentData().IsActive = d.Data.IsActive
if d.Components[d.ActiveComponent].Update(key) {
if d.ActiveComponent < len(d.Components)-1 {
d.updateActive(d.ActiveComponent + 1)
} else {
return true
}
return true
// if d.ActiveComponent < len(d.Components)-1 {
// d.updateActive(d.ActiveComponent + 1)
// } else {
// return true
// }
}
}
}
return false
}
func (d *DivComponent) SetStyle(c interface{}) {
d.Style = osui.SetDefaults(c.(*DivStyle)).(*DivStyle)
}
func (d *DivComponent) updateActive(newIndex int) {
if newIndex >= 0 && newIndex < len(d.Components) && len(d.Components) > 0 {
d.ActiveComponent = newIndex