narratio/editor/gui.go

32 lines
443 B
Go

package editor
type GUI struct {
cmd chan Command
refresh chan bool
s *State
}
func NewGUI(s *State, refresh chan bool, cmd chan Command) *GUI {
g := &GUI{
refresh: refresh,
cmd: cmd,
s: s,
}
return g
}
func (g *GUI) Run() {
go func() {
for range g.refresh {
g.Update()
}
}()
}
func (g *GUI) Update() {
content := []string{g.s.Document.Title}
content = append(content, g.s.Document.Lines...)
}