aboutsummaryrefslogtreecommitdiffstats
path: root/termui/show_bug.go
diff options
context:
space:
mode:
Diffstat (limited to 'termui/show_bug.go')
-rw-r--r--termui/show_bug.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/termui/show_bug.go b/termui/show_bug.go
index aa52c8a3..6df744bd 100644
--- a/termui/show_bug.go
+++ b/termui/show_bug.go
@@ -184,6 +184,12 @@ func (sb *showBug) keybindings(g *gocui.Gui) error {
return err
}
+ // Edit
+ if err := g.SetKeybinding(showBugView, 'e', gocui.ModNone,
+ sb.edit); err != nil {
+ return err
+ }
+
// Labels
if err := g.SetKeybinding(showBugView, 'a', gocui.ModNone,
sb.addLabel); err != nil {
@@ -621,6 +627,32 @@ func (sb *showBug) toggleOpenClose(g *gocui.Gui, v *gocui.View) error {
}
}
+func (sb *showBug) edit(g *gocui.Gui, v *gocui.View) error {
+ if sb.isOnSide {
+ ui.msgPopup.Activate(msgPopupErrorTitle, "Selected field is not editable.")
+ return nil
+ }
+
+ snap := sb.bug.Snapshot()
+
+ op, err := snap.SearchTimelineItem(git.Hash(sb.selected))
+ if err != nil {
+ return err
+ }
+
+ switch op.(type) {
+ case *bug.AddCommentTimelineItem:
+ message := op.(*bug.AddCommentTimelineItem).Message
+ return editCommentWithEditor(sb.bug, op.Hash(), message)
+ case *bug.CreateTimelineItem:
+ preMessage := op.(*bug.CreateTimelineItem).Message
+ return editCommentWithEditor(sb.bug, op.Hash(), preMessage)
+ }
+
+ ui.msgPopup.Activate(msgPopupErrorTitle, "Selected field is not editable.")
+ return nil
+}
+
func (sb *showBug) addLabel(g *gocui.Gui, v *gocui.View) error {
c := ui.inputPopup.Activate("Add labels")