func editValue(g *gocui.Gui, v *gocui.View) error { var l string var err error _, cy := v.Cursor() global.placeholder, _ = myViews.placeholders.Line(cy) if l, err = myViews.values.Line(cy); err != nil { l = "" } maxX, maxY := g.Size() if v, err := g.SetView("dialog", maxX/2-30, maxY/2, maxX/2+30, maxY/2+2); err != nil { if err != gocui.ErrUnknownView { return err } lx := len(l) fmt.Fprintln(v, l[:lx]) if l == " " { lx = 0 } v.SetCursor(lx, 0) if err := g.SetCurrentView("dialog"); err != nil { return err } v.Editable = true myViews.dialog = v } return nil }
func getScreenConf(g *gocui.Gui) ScreenConf { var sc ScreenConf w, h := g.Size() sc.Width = w sc.Height = h sc.TitleHeight = 1 sc.LinesOfHelp = 2 sc.AppsWidth = 30 sc.UseFrame = 1 if w < 100 { sc.UseFrame = 0 sc.AppsWidth = 24 } return sc }