diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-27 21:25:37 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-28 11:59:45 +1100 |
commit | c1a4bd0482ab06279700fa95404131ef24a2297d (patch) | |
tree | f3c6a24a7a6cc482fe14f2001d704edefff59bc9 /pkg/gui/tags_panel.go | |
parent | d0336fe16f3a365eb9bfff1086a4c02277e1f5dd (diff) |
more smart refreshing
WIP
WIP
WIP
WIP
WIP
fix how diff entries are handled
WIP
WIP
WIP
WIP
WIP
WIP
Diffstat (limited to 'pkg/gui/tags_panel.go')
-rw-r--r-- | pkg/gui/tags_panel.go | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/pkg/gui/tags_panel.go b/pkg/gui/tags_panel.go index 78c3122cd..62f4c99fa 100644 --- a/pkg/gui/tags_panel.go +++ b/pkg/gui/tags_panel.go @@ -69,7 +69,7 @@ func (gui *Gui) renderTagsWithSelection() error { gui.renderDisplayStrings(branchesView, displayStrings) if gui.g.CurrentView() == branchesView && branchesView.Context == "tags" { if err := gui.handleTagSelect(gui.g, branchesView); err != nil { - return err + return gui.createErrorPanel(gui.g, err.Error()) } } @@ -104,13 +104,7 @@ func (gui *Gui) handleDeleteTag(g *gocui.Gui, v *gocui.View) error { if err := gui.GitCommand.DeleteTag(tag.Name); err != nil { return gui.createErrorPanel(gui.g, err.Error()) } - if err := gui.refreshCommits(); err != nil { - return gui.createErrorPanel(g, err.Error()) - } - if err := gui.refreshTags(); err != nil { - return gui.createErrorPanel(g, err.Error()) - } - return nil + return gui.refreshSidePanels(refreshOptions{mode: ASYNC, scope: []int{COMMITS, TAGS}}) }, nil) } @@ -131,23 +125,28 @@ func (gui *Gui) handlePushTag(g *gocui.Gui, v *gocui.View) error { if err := gui.GitCommand.PushTag(v.Buffer(), tag.Name); err != nil { return gui.createErrorPanel(gui.g, err.Error()) } - return gui.refreshTags() + return nil }) } func (gui *Gui) handleCreateTag(g *gocui.Gui, v *gocui.View) error { return gui.createPromptPanel(gui.g, v, gui.Tr.SLocalize("CreateTagTitle"), "", func(g *gocui.Gui, v *gocui.View) error { // leaving commit SHA blank so that we're just creating the tag for the current commit - if err := gui.GitCommand.CreateLightweightTag(v.Buffer(), ""); err != nil { + tagName := v.Buffer() + if err := gui.GitCommand.CreateLightweightTag(tagName, ""); err != nil { return gui.createErrorPanel(gui.g, err.Error()) } - if err := gui.refreshCommits(); err != nil { - return gui.createErrorPanel(g, err.Error()) - } - if err := gui.refreshTags(); err != nil { - return gui.createErrorPanel(g, err.Error()) - } - return nil + return gui.refreshSidePanels(refreshOptions{scope: []int{COMMITS, TAGS}, then: func() { + // find the index of the tag and set that as the currently selected line + for i, tag := range gui.State.Tags { + if tag.Name == tagName { + gui.State.Panels.Tags.SelectedLine = i + gui.renderTagsWithSelection() + return + } + } + }, + }) }) } |