Skip to content

Commit b3745fa

Browse files
committed
Add DisabledReason for rebase options when not rebasing or merging
1 parent e2c2b62 commit b3745fa

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

Diff for: pkg/gui/controllers/global_controller.go

+16-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package controllers
22

33
import (
44
"github.com/jesseduffield/gocui"
5+
"github.com/jesseduffield/lazygit/pkg/commands/types/enums"
56
"github.com/jesseduffield/lazygit/pkg/gui/types"
67
)
78

@@ -35,11 +36,12 @@ func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*type
3536
OpensMenu: true,
3637
},
3738
{
38-
Key: opts.GetKey(opts.Config.Universal.CreateRebaseOptionsMenu),
39-
Handler: opts.Guards.NoPopupPanel(self.c.Helpers().MergeAndRebase.CreateRebaseOptionsMenu),
40-
Description: self.c.Tr.ViewMergeRebaseOptions,
41-
Tooltip: self.c.Tr.ViewMergeRebaseOptionsTooltip,
42-
OpensMenu: true,
39+
Key: opts.GetKey(opts.Config.Universal.CreateRebaseOptionsMenu),
40+
Handler: opts.Guards.NoPopupPanel(self.c.Helpers().MergeAndRebase.CreateRebaseOptionsMenu),
41+
Description: self.c.Tr.ViewMergeRebaseOptions,
42+
Tooltip: self.c.Tr.ViewMergeRebaseOptionsTooltip,
43+
OpensMenu: true,
44+
GetDisabledReason: self.canShowRebaseOptions,
4345
},
4446
{
4547
Key: opts.GetKey(opts.Config.Universal.Refresh),
@@ -191,3 +193,12 @@ func (self *GlobalController) escape() error {
191193
func (self *GlobalController) toggleWhitespace() error {
192194
return (&ToggleWhitespaceAction{c: self.c}).Call()
193195
}
196+
197+
func (self *GlobalController) canShowRebaseOptions() *types.DisabledReason {
198+
if self.c.Model().WorkingTreeStateAtLastCommitRefresh == enums.WORKING_TREE_STATE_NONE {
199+
return &types.DisabledReason{
200+
Text: self.c.Tr.NotMergingOrRebasing,
201+
}
202+
}
203+
return nil
204+
}

0 commit comments

Comments
 (0)