Skip to content

Commit

Permalink
set tag index directly
Browse files Browse the repository at this point in the history
We can do this since they are already sorted by date created.
  • Loading branch information
Francisco Miamoto committed Dec 25, 2021
1 parent a430948 commit a0614fb
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions pkg/gui/commits_panel.go
Original file line number Diff line number Diff line change
Expand Up @@ -607,18 +607,8 @@ func (gui *Gui) createTagMenu(commitSha string) error {
}

func (gui *Gui) afterTagCreate(tagName string) error {
return gui.refreshSidePanels(refreshOptions{mode: ASYNC, scope: []RefreshableView{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.SelectedLineIdx = i
if err := gui.State.Contexts.Tags.HandleRender(); err != nil {
gui.Log.Error(err)
}
return
}
}
}})
gui.State.Panels.Tags.SelectedLineIdx = 0 // Set to the top
return gui.refreshSidePanels(refreshOptions{mode: ASYNC, scope: []RefreshableView{COMMITS, TAGS}})
}

func (gui *Gui) handleCreateAnnotatedTag(commitSha string) error {
Expand Down

0 comments on commit a0614fb

Please sign in to comment.