Don't show error toast for disabled keybindings if DisabledReason text is empty

This makes it possible to "silently" disable a keybinding. The effect is the
same as putting the check in the handler and returning nil from there, except
that doing it this way also hides it from the bottom line if DisplayOnScreen is
true.
This commit is contained in:
Stefan Haller 2025-01-02 19:43:32 +01:00
parent 9776be3131
commit 9de8d17d84

View file

@ -453,7 +453,9 @@ func (gui *Gui) callKeybindingHandler(binding *types.Binding) error {
return errors.New(disabledReason.Text)
}
gui.c.ErrorToast(gui.Tr.DisabledMenuItemPrefix + disabledReason.Text)
if len(disabledReason.Text) > 0 {
gui.c.ErrorToast(gui.Tr.DisabledMenuItemPrefix + disabledReason.Text)
}
return nil
}
return binding.Handler()