MCPcopy Index your code
hub / github.com/git-bug/git-bug / layout

Method layout

termui/input_popup.go:38–70  ·  view source on GitHub ↗
(g *gocui.Gui)

Source from the content-addressed store, hash-verified

36}
37
38func (ip *inputPopup) layout(g *gocui.Gui) error {
39 if !ip.active {
40 return nil
41 }
42
43 maxX, maxY := g.Size()
44
45 width := minInt(30, maxX)
46 height := 2
47 x0 := (maxX - width) / 2
48 y0 := (maxY - height) / 2
49
50 v, err := g.SetView(inputPopupView, x0, y0, x0+width, y0+height, 0)
51 if err != nil {
52 if !errors.Is(err, gocui.ErrUnknownView) {
53 return err
54 }
55
56 v.Frame = true
57 v.Title = ip.title
58 v.Editable = true
59 _, err = v.Write([]byte(ip.preload))
60 if err != nil {
61 return err
62 }
63 }
64
65 if _, err := g.SetCurrentView(inputPopupView); err != nil {
66 return err
67 }
68
69 return nil
70}
71
72func (ip *inputPopup) close(g *gocui.Gui, v *gocui.View) error {
73 ip.title = ""

Callers

nothing calls this directly

Calls 3

minIntFunction · 0.85
SizeMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected