Skip to content

Commit 9eb1e3a

Browse files
committed
Add a GetShortDescription() method to Binding
1 parent d0438b7 commit 9eb1e3a

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

pkg/gui/options_map.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,9 @@ func (self *OptionsMapMgr) renderContextOptionsMap() {
5050
displayStyle = *binding.DisplayStyle
5151
}
5252

53-
description := binding.Description
54-
if binding.ShortDescription != "" {
55-
description = binding.ShortDescription
56-
}
57-
5853
return bindingInfo{
5954
key: keybindings.LabelFromKey(binding.Key),
60-
description: description,
55+
description: binding.GetShortDescription(),
6156
style: displayStyle,
6257
}
6358
})

pkg/gui/types/keybindings.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ func (b *Binding) IsDisabled() bool {
4747
return b.GetDisabledReason != nil && b.GetDisabledReason() != nil
4848
}
4949

50+
func (b *Binding) GetShortDescription() string {
51+
if b.ShortDescription != "" {
52+
return b.ShortDescription
53+
}
54+
return b.Description
55+
}
56+
5057
// A guard is a decorator which checks something before executing a handler
5158
// and potentially early-exits if some precondition hasn't been met.
5259
type Guard func(func() error) func() error

0 commit comments

Comments
 (0)