diff options
author | Luke Adams <lukeclydeadams@gmail.com> | 2018-10-04 13:30:04 -0600 |
---|---|---|
committer | Luke Adams <lukeclydeadams@gmail.com> | 2018-10-04 13:51:00 -0600 |
commit | da1af3458402449cbdfc3cdf0319c890196ccf1a (patch) | |
tree | 3b2b1239c46b36860121969a999edeb95ef83db2 /termui/show_bug.go | |
parent | 59658bb98e27ca60cd8ae7f7029edf9ca46830c4 (diff) | |
download | git-bug-da1af3458402449cbdfc3cdf0319c890196ccf1a.tar.gz |
Remove old label editing code from showBug
Diffstat (limited to 'termui/show_bug.go')
-rw-r--r-- | termui/show_bug.go | 76 |
1 files changed, 1 insertions, 75 deletions
diff --git a/termui/show_bug.go b/termui/show_bug.go index 71237cbf..6cf0784f 100644 --- a/termui/show_bug.go +++ b/termui/show_bug.go @@ -95,13 +95,7 @@ func (sb *showBug) layout(g *gocui.Gui) error { } v.Clear() - fmt.Fprintf(v, "[q] Save and return [←↓↑→,hjkl] Navigation ") - - if sb.isOnSide { - fmt.Fprint(v, "[a] Add label [r] Remove label") - } else { - fmt.Fprint(v, "[o] Toggle open/close [e] Edit [c] Comment [t] Change title") - } + fmt.Fprintf(v, "[q] Save and return [←↓↑→,hjkl] Navigation [o] Toggle open/close [e] Edit [c] Comment [t] Change title") _, err = g.SetViewOnTop(showBugInstructionView) if err != nil { @@ -190,16 +184,6 @@ func (sb *showBug) keybindings(g *gocui.Gui) error { return err } - // Labels - if err := g.SetKeybinding(showBugView, 'a', gocui.ModNone, - sb.addLabel); err != nil { - return err - } - if err := g.SetKeybinding(showBugView, 'r', gocui.ModNone, - sb.removeLabel); err != nil { - return err - } - return nil } @@ -658,61 +642,3 @@ func (sb *showBug) editLabels(g *gocui.Gui, snap *bug.Snapshot) error { ui.labelSelect.SetBug(sb.cache, sb.bug) return ui.activateWindow(ui.labelSelect) } - -func (sb *showBug) addLabel(g *gocui.Gui, v *gocui.View) error { - c := ui.inputPopup.Activate("Add labels") - - go func() { - input := <-c - - labels := strings.FieldsFunc(input, func(r rune) bool { - return r == ' ' || r == ',' - }) - - _, err := sb.bug.ChangeLabels(trimLabels(labels), nil) - if err != nil { - ui.msgPopup.Activate(msgPopupErrorTitle, err.Error()) - } - - g.Update(func(gui *gocui.Gui) error { - return nil - }) - }() - - return nil -} - -func (sb *showBug) removeLabel(g *gocui.Gui, v *gocui.View) error { - c := ui.inputPopup.Activate("Remove labels") - - go func() { - input := <-c - - labels := strings.FieldsFunc(input, func(r rune) bool { - return r == ' ' || r == ',' - }) - - _, err := sb.bug.ChangeLabels(nil, trimLabels(labels)) - if err != nil { - ui.msgPopup.Activate(msgPopupErrorTitle, err.Error()) - } - - g.Update(func(gui *gocui.Gui) error { - return nil - }) - }() - - return nil -} - -func trimLabels(labels []string) []string { - var result []string - - for _, label := range labels { - trimmed := strings.TrimSpace(label) - if len(trimmed) > 0 { - result = append(result, trimmed) - } - } - return result -} |