diff --git a/main.go b/main.go index d6f1018..11cc1b0 100644 --- a/main.go +++ b/main.go @@ -14,6 +14,7 @@ func main() { defer kbtui.Close() kbtui.SetManagerFunc(layout) + printToView(kbtui, "Chat", "Test updating chat window") if err := kbtui.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, quit); err != nil { log.Panicln(err) @@ -24,6 +25,18 @@ func main() { } } +func printToView(kbtui *gocui.Gui, viewName string, message string) { + kbtui.Update(func(g *gocui.Gui) error { + inputView, err := kbtui.View(viewName) + if err != nil { + return err + } else { + _, _ = fmt.Fprintf(inputView, message) + } + return nil + }) +} + func layout(g *gocui.Gui) error { maxX, maxY := g.Size() if feedView, err := g.SetView("Feed", 12, 0, maxX-1, maxY/5); err != nil { @@ -48,7 +61,7 @@ func layout(g *gocui.Gui) error { if err4 != gocui.ErrUnknownView { return err4 } - fmt.Fprintln(listView, "Lists") + fmt.Fprintf(listView, "Lists\nWindow") } return nil }