1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

Show radio buttons in the show log graph and commit sort order menus

This commit is contained in:
Stefan Haller
2024-06-01 20:26:24 +02:00
parent 68c966567c
commit 4967e5136e

View File

@ -1085,6 +1085,7 @@ func (self *LocalCommitsController) handleOpenLogMenu() error {
Label: self.c.Tr.ShowGitGraph, Label: self.c.Tr.ShowGitGraph,
OpensMenu: true, OpensMenu: true,
OnPress: func() error { OnPress: func() error {
currentValue := self.c.GetAppState().GitLogShowGraph
onPress := func(value string) func() error { onPress := func(value string) func() error {
return func() error { return func() error {
self.c.GetAppState().GitLogShowGraph = value self.c.GetAppState().GitLogShowGraph = value
@ -1101,14 +1102,17 @@ func (self *LocalCommitsController) handleOpenLogMenu() error {
{ {
Label: "always", Label: "always",
OnPress: onPress("always"), OnPress: onPress("always"),
Widget: types.MakeMenuRadioButton(currentValue == "always"),
}, },
{ {
Label: "never", Label: "never",
OnPress: onPress("never"), OnPress: onPress("never"),
Widget: types.MakeMenuRadioButton(currentValue == "never"),
}, },
{ {
Label: "when maximised", Label: "when maximised",
OnPress: onPress("when-maximised"), OnPress: onPress("when-maximised"),
Widget: types.MakeMenuRadioButton(currentValue == "when-maximised"),
}, },
}, },
}) })
@ -1118,6 +1122,7 @@ func (self *LocalCommitsController) handleOpenLogMenu() error {
Label: self.c.Tr.SortCommits, Label: self.c.Tr.SortCommits,
OpensMenu: true, OpensMenu: true,
OnPress: func() error { OnPress: func() error {
currentValue := self.c.GetAppState().GitLogOrder
onPress := func(value string) func() error { onPress := func(value string) func() error {
return func() error { return func() error {
self.c.GetAppState().GitLogOrder = value self.c.GetAppState().GitLogOrder = value
@ -1139,14 +1144,17 @@ func (self *LocalCommitsController) handleOpenLogMenu() error {
{ {
Label: "topological (topo-order)", Label: "topological (topo-order)",
OnPress: onPress("topo-order"), OnPress: onPress("topo-order"),
Widget: types.MakeMenuRadioButton(currentValue == "topo-order"),
}, },
{ {
Label: "date-order", Label: "date-order",
OnPress: onPress("date-order"), OnPress: onPress("date-order"),
Widget: types.MakeMenuRadioButton(currentValue == "date-order"),
}, },
{ {
Label: "author-date-order", Label: "author-date-order",
OnPress: onPress("author-date-order"), OnPress: onPress("author-date-order"),
Widget: types.MakeMenuRadioButton(currentValue == "author-date-order"),
}, },
}, },
}) })