diff options
author | Luke Adams <lukeclydeadams@gmail.com> | 2018-10-02 14:14:06 -0600 |
---|---|---|
committer | Luke Adams <lukeclydeadams@gmail.com> | 2018-10-02 14:14:06 -0600 |
commit | f262a01b1f555031958063b99988195e69ade4d9 (patch) | |
tree | 90bb515e309147bf6bcde43dfedb1495b207b511 /termui/show_bug.go | |
parent | b5025a51a2da8e2a3be86ae3b1ece21d5fc0f789 (diff) | |
download | git-bug-f262a01b1f555031958063b99988195e69ade4d9.tar.gz |
add open/close in bug view
Diffstat (limited to 'termui/show_bug.go')
-rw-r--r-- | termui/show_bug.go | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/termui/show_bug.go b/termui/show_bug.go index 32bea95a..6a750456 100644 --- a/termui/show_bug.go +++ b/termui/show_bug.go @@ -94,7 +94,7 @@ func (sb *showBug) layout(g *gocui.Gui) error { } v.Clear() - fmt.Fprintf(v, "[q] Save and return [←↓↑→,hjkl] Navigation ") + fmt.Fprintf(v, "[q] Save and return [←↓↑→,hjkl] Navigation [o] Toggle open/close ") if sb.isOnSide { fmt.Fprint(v, "[a] Add label [r] Remove label") @@ -171,6 +171,12 @@ func (sb *showBug) keybindings(g *gocui.Gui) error { return err } + // Open/close + if err := g.SetKeybinding(showBugView, 'o', gocui.ModNone, + sb.toggleOpenClose); err != nil { + return err + } + // Title if err := g.SetKeybinding(showBugView, 't', gocui.ModNone, sb.setTitle); err != nil { @@ -603,6 +609,14 @@ func (sb *showBug) setTitle(g *gocui.Gui, v *gocui.View) error { return setTitleWithEditor(sb.bug) } +func (sb *showBug) toggleOpenClose(g *gocui.Gui, v *gocui.View) error { + if sb.bug.Snapshot().Status.String() == "open" { + return sb.bug.Close() + } else { + return sb.bug.Open() + } +} + func (sb *showBug) addLabel(g *gocui.Gui, v *gocui.View) error { c := ui.inputPopup.Activate("Add labels") |