diff options
author | Michael Muré <batolettre@gmail.com> | 2018-08-09 14:45:02 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-08-09 14:45:02 +0200 |
commit | 5675299c8dd9488c3b60142d8da8b112473a0cd4 (patch) | |
tree | a8cbd22610c1321e32a04f641d73947c424ff52e /termui | |
parent | b6087d7e35dd0f687264ef3a743ccc3871bd3b64 (diff) | |
download | git-bug-5675299c8dd9488c3b60142d8da8b112473a0cd4.tar.gz |
termui: commit the bug when quiting the show bug window
Diffstat (limited to 'termui')
-rw-r--r-- | termui/show_bug.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/termui/show_bug.go b/termui/show_bug.go index 0189b2b3..aecdce4b 100644 --- a/termui/show_bug.go +++ b/termui/show_bug.go @@ -76,7 +76,7 @@ func (sb *showBug) layout(g *gocui.Gui) error { v.Frame = false v.BgColor = gocui.ColorBlue - fmt.Fprintf(v, "[q] Return [c] Comment [t] Change title [↓,j] Down [↑,k] Up") + fmt.Fprintf(v, "[q] Save and return [c] Comment [t] Change title [↓,j] Down [↑,k] Up") } _, err = g.SetCurrentView(showBugView) @@ -85,7 +85,7 @@ func (sb *showBug) layout(g *gocui.Gui) error { func (sb *showBug) keybindings(g *gocui.Gui) error { // Return - if err := g.SetKeybinding(showBugView, 'q', gocui.ModNone, sb.back); err != nil { + if err := g.SetKeybinding(showBugView, 'q', gocui.ModNone, sb.saveAndBack); err != nil { return err } @@ -263,7 +263,11 @@ func (sb *showBug) renderSidebar(v *gocui.View) { } } -func (sb *showBug) back(g *gocui.Gui, v *gocui.View) error { +func (sb *showBug) saveAndBack(g *gocui.Gui, v *gocui.View) error { + err := sb.bug.CommitAsNeeded() + if err != nil { + return err + } ui.activateWindow(ui.bugTable) return nil } |