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

Function initGui

termui/termui.go:83–124  ·  view source on GitHub ↗
(action func(ui *termUI) error)

Source from the content-addressed store, hash-verified

81}
82
83func initGui(action func(ui *termUI) error) {
84 g, err := gocui.NewGui(gocui.Output256, false)
85
86 if err != nil {
87 ui.gError <- err
88 return
89 }
90
91 ui.g = g
92
93 ui.g.SetManagerFunc(layout)
94
95 ui.g.InputEsc = true
96
97 err = keybindings(ui.g)
98
99 if err != nil {
100 ui.g.Close()
101 ui.g = nil
102 ui.gError <- err
103 return
104 }
105
106 if action != nil {
107 err = action(ui)
108 if err != nil {
109 ui.g.Close()
110 ui.g = nil
111 ui.gError <- err
112 return
113 }
114 }
115
116 err = g.MainLoop()
117
118 if err != nil && err != errTerminateMainloop {
119 if ui.g != nil {
120 ui.g.Close()
121 }
122 ui.gError <- err
123 }
124}
125
126func layout(g *gocui.Gui) error {
127 g.Cursor = false

Callers 6

RunFunction · 0.85
newBugWithEditorFunction · 0.85
addCommentWithEditorFunction · 0.85
editCommentWithEditorFunction · 0.85
setTitleWithEditorFunction · 0.85
editQueryWithEditorFunction · 0.85

Calls 2

keybindingsFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected