aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Adams <lukeclydeadams@gmail.com>2018-10-05 12:22:15 -0600
committerLuke Adams <lukeclydeadams@gmail.com>2018-10-05 12:22:15 -0600
commitb23f539a77c4ff16520e3b643a65e7be25129258 (patch)
tree9acd7106a62aec0902c3efb1a38be02d24002a50
parentb1b310d97837f9820be123b975727274331f04c0 (diff)
downloadgit-bug-b23f539a77c4ff16520e3b643a65e7be25129258.tar.gz
Error checking and cleanup
-rw-r--r--termui/label_select.go20
1 files changed, 13 insertions, 7 deletions
diff --git a/termui/label_select.go b/termui/label_select.go
index 3f2c4457..56404559 100644
--- a/termui/label_select.go
+++ b/termui/label_select.go
@@ -166,10 +166,11 @@ func (ls *labelSelect) disable(g *gocui.Gui) error {
}
func (ls *labelSelect) focusView(g *gocui.Gui) error {
- // lsx0, lsy0, lsx1, lsy1, err := g.ViewPosition(labelSelectView)
_, lsy0, _, lsy1, err := g.ViewPosition(labelSelectView)
+ if err != nil {
+ return err
+ }
- // vx0, vy0, vx1, vy1, err := g.ViewPosition(fmt.Sprintf("view%d", ls.selected))
_, vy0, _, vy1, err := g.ViewPosition(fmt.Sprintf("view%d", ls.selected))
if err != nil {
return err
@@ -207,7 +208,7 @@ func(ls *labelSelect) selectItem(g *gocui.Gui, v *gocui.View) error {
func (ls *labelSelect) addItem(g *gocui.Gui, v *gocui.View) error {
c := ui.inputPopup.Activate("Add a new label")
- go func() error {
+ go func() {
input := <-c
// Standardize label format
@@ -220,10 +221,15 @@ func (ls *labelSelect) addItem(g *gocui.Gui, v *gocui.View) error {
ls.labelSelect[i] = true
ls.selected = i
+ if err := ls.focusView(g); err != nil {
+ panic(err)
+ }
+
g.Update(func(gui *gocui.Gui) error {
return nil
})
- return ls.focusView(g)
+
+ return
}
}
@@ -232,7 +238,9 @@ func (ls *labelSelect) addItem(g *gocui.Gui, v *gocui.View) error {
ls.labelSelect = append(ls.labelSelect, true)
ls.selected = len(ls.labels) - 1
- ls.layout(g)
+ if err := ls.layout(g); err != nil {
+ panic(err)
+ }
if err := ls.focusView(g); err != nil {
panic(err)
@@ -241,8 +249,6 @@ func (ls *labelSelect) addItem(g *gocui.Gui, v *gocui.View) error {
g.Update(func(gui *gocui.Gui) error {
return nil
})
-
- return nil
}()
return nil