Leave a command with nothing to say out of the options bar

A command that acts on a diff selection has nothing to say over content that
isn't a diff, and says so by describing itself as nothing — but a binding
that is displayed on screen is displayed whatever its description, so it
would show as a key with an empty label. Leave it out instead.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stefan Haller
2026-09-27 18:26:55 +02:00
co-authored by Claude Opus 5
parent 33e53a7579
commit 720097da50
+5 -1
View File
@@ -50,7 +50,11 @@ func (self *OptionsMapMgr) renderContextOptionsMap() {
})...)
bindingsToDisplay := lo.Filter(allBindings, func(binding *types.Binding, _ int) bool {
return len(binding.Keys) > 0 && binding.DisplayOnScreen && !binding.IsDisabled()
// A binding that describes itself as nothing has nothing to do where we are —
// that is how a command which only applies to some of a view's contents says so
// — and an empty entry in the options bar would say nothing about it.
return len(binding.Keys) > 0 && binding.DisplayOnScreen && !binding.IsDisabled() &&
binding.GetShortDescription() != ""
})
optionsMap := lo.Map(bindingsToDisplay, func(binding *types.Binding, _ int) bindingInfo {