1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-03-17 21:18:31 +02:00

set tag index directly

We can do this since they are already sorted by date created.
This commit is contained in:
Francisco Miamoto 2021-10-28 20:21:07 -03:00 committed by Jesse Duffield
parent b8735cc609
commit 8c8b925b3a

View File

@ -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 {