Exemplo n.º 1
0
func nextView(g *gocui.Gui, v *gocui.View) error {
	if v.Name() == "apps" {
		return g.SetCurrentView("placeholders")
	}
	if v.Name() == "placeholders" {
		return g.SetCurrentView("apps")
	}
	return g.SetCurrentView("apps")
}
Exemplo n.º 2
0
func moveCursor(v *gocui.View, direction int) error {
	if v != nil {
		ox, oy := v.Origin()
		cx, cy := v.Cursor()
		err := v.SetCursor(cx, cy+direction)
		if v.Name() == "placeholders" {
			myViews.values.SetCursor(cx, cy+direction)
		}
		if err != nil && (direction == 1 || (direction == -1 && oy > 0)) {
			if v.Name() == "placeholders" {
				myViews.values.SetOrigin(ox, oy+direction)
			}
			if err := v.SetOrigin(ox, oy+direction); err != nil {
				return err
			}
		}
	}
	return nil
}