func (runner *appRunner) layout(g *gocui.Gui) error { maxX, maxY := g.Size() view, _ := g.SetView("mainControls", -1, -1, maxX/2, maxY) _, originY := view.Origin() _, cursorY := view.Cursor() view.Clear() runner.mainControlLines = 0 runner.highlightedTexter = nil if g.CurrentView() == nil { g.SetCurrentView("mainControls") } view.Highlight = g.CurrentView() == view runner.rootTexter.TextMain(func(label, line string, texter ViewModelNodeTexter) { paddedLabel := fmt.Sprintf("%20s", label) fmt.Fprintf(view, "%s %v\n", paddedLabel[len(paddedLabel)-20:len(paddedLabel)], line) if (originY + cursorY) == runner.mainControlLines { runner.highlightedTexter = texter } runner.mainControlLines++ }) return nil }
func nextView(g *gocui.Gui, v *gocui.View) error { currentView := g.CurrentView() if currentView == nil || currentView.Name() == "side" { return g.SetCurrentView("main") } return g.SetCurrentView("side") }
func nextView(g *gocui.Gui, v *gocui.View) error { currentView := g.CurrentView() if currentView == nil || currentView.Name() == "contacts" { return g.SetCurrentView("input") } return g.SetCurrentView("contacts") }
func nextView(g *gocui.Gui, v *gocui.View) error { g.Cursor = false v.Highlight = false log.Println("nextView: " + v.Name()) var err error switch v.Name() { case "channels": err = g.SetCurrentView("input") g.Cursor = true case "input": err = g.SetCurrentView("channels") g.CurrentView().Highlight = true } // g.Flush() return err }
func nextSummary(g *gocui.Gui, v *gocui.View) error { if v != nil { // cursor to summary if err := g.SetCurrentView("summary"); err != nil { return err } // move next line if err := cursorDown(g, g.CurrentView()); err != nil { return err } // cursor to detail if err := g.SetCurrentView("detail"); err != nil { return err } } return nil }