diff --git a/list/defaultitem.go b/list/defaultitem.go index 04dfe7b9..9e0d5487 100644 --- a/list/defaultitem.go +++ b/list/defaultitem.go @@ -86,6 +86,7 @@ type DefaultDelegate struct { UpdateFunc func(tea.Msg, *Model) tea.Cmd ShortHelpFunc func() []key.Binding FullHelpFunc func() [][]key.Binding + height int spacing int } @@ -94,14 +95,22 @@ func NewDefaultDelegate() DefaultDelegate { return DefaultDelegate{ ShowDescription: true, Styles: NewDefaultItemStyles(), + height: 2, spacing: 1, } } +// SetHeight sets delegate's preferred height. +func (d *DefaultDelegate) SetHeight(i int) { + d.height = i +} + // Height returns the delegate's preferred height. +// This has effect only if ShowDescription is true, +// otherwise height is always 1. func (d DefaultDelegate) Height() int { if d.ShowDescription { - return 2 //nolint:gomnd + return d.height } return 1 }