This commit is contained in:
2024-09-28 19:29:01 +02:00
parent 90f106f127
commit 8592b1cc50
12 changed files with 222 additions and 47 deletions
+1 -8
View File
@@ -15,13 +15,6 @@ type ComponentData struct {
DefaultColor string
IsActive bool
Screen *Screen
Update func(string) bool
}
func NewComponent(c Component) Component {
data := c.GetComponentData()
data.Update = func(s string) bool { return c.Update(s) }
return c
}
type Component interface {
@@ -71,7 +64,7 @@ func (s *Screen) Run() {
for {
s.Render()
k, _ := ReadKey()
if data.Update(k) {
if s.component.Update(k) {
ShowCursor()
return
}