From 9de8d17d846f1309c4e89a8143f66d0116b0ed08 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Thu, 2 Jan 2025 19:43:32 +0100 Subject: [PATCH] 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. --- pkg/gui/keybindings.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index c10f67623..371d039a6 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -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()