1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-06 11:02:41 +03:00

Add a prompt for the sort order menus for branches

This commit is contained in:
Stefan Haller
2025-07-08 17:32:51 +02:00
parent 6bfcb3d6f0
commit df48667253
7 changed files with 40 additions and 22 deletions

View File

@@ -673,15 +673,18 @@ func (self *BranchesController) createTag(branch *models.Branch) error {
}
func (self *BranchesController) createSortMenu() error {
return self.c.Helpers().Refs.CreateSortOrderMenu([]string{"recency", "alphabetical", "date"}, func(sortOrder string) error {
if self.c.UserConfig().Git.LocalBranchSortOrder != sortOrder {
self.c.UserConfig().Git.LocalBranchSortOrder = sortOrder
self.c.Contexts().Branches.SetSelection(0)
self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.BRANCHES}})
return self.c.Helpers().Refs.CreateSortOrderMenu(
[]string{"recency", "alphabetical", "date"},
self.c.Tr.SortOrderPromptLocalBranches,
func(sortOrder string) error {
if self.c.UserConfig().Git.LocalBranchSortOrder != sortOrder {
self.c.UserConfig().Git.LocalBranchSortOrder = sortOrder
self.c.Contexts().Branches.SetSelection(0)
self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.BRANCHES}})
return nil
}
return nil
}
return nil
},
},
self.c.UserConfig().Git.LocalBranchSortOrder)
}