From 8c8b925b3a122624ed860b76510a8108e34193d9 Mon Sep 17 00:00:00 2001 From: Francisco Miamoto Date: Thu, 28 Oct 2021 20:21:07 -0300 Subject: [PATCH] set tag index directly We can do this since they are already sorted by date created. --- pkg/gui/commits_panel.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/pkg/gui/commits_panel.go b/pkg/gui/commits_panel.go index 69765b8a5..01039e028 100644 --- a/pkg/gui/commits_panel.go +++ b/pkg/gui/commits_panel.go @@ -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 {