mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-15 00:15:32 +02:00
Add DisabledReason field to MenuItem
This is useful to disable items that are not applicable right now because of some condition (e.g. the "delete branch" menu item when the currently checked-out branch is selected). When a DisabledReason is set on a menu item, we - show it in a tooltip (below the regular tooltip of the item, if it has one) - strike through the item's key, if it has one - show an error message with the DisabledReason if the user tries to invoke the command
This commit is contained in:
@ -54,7 +54,7 @@ func (self *MenuController) GetOnFocus() func(types.OnFocusOpts) error {
|
||||
return func(types.OnFocusOpts) error {
|
||||
selectedMenuItem := self.context().GetSelected()
|
||||
if selectedMenuItem != nil {
|
||||
self.c.Views().Tooltip.SetContent(selectedMenuItem.Tooltip)
|
||||
self.c.Views().Tooltip.SetContent(self.c.Helpers().Confirmation.TooltipForMenuItem(selectedMenuItem))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user