diff --git a/filepicker/filepicker.go b/filepicker/filepicker.go index ec96e3d..487ca96 100644 --- a/filepicker/filepicker.go +++ b/filepicker/filepicker.go @@ -158,6 +158,9 @@ type Model struct { maxStack stack minStack stack + // Height of the picker. + // + // Deprecated: use [Model.SetHeight] instead. Height int AutoHeight bool @@ -233,6 +236,14 @@ func (m Model) Init() tea.Cmd { return m.readDir(m.CurrentDirectory, m.ShowHidden) } +// SetHeight sets the height of the filepicker. +func (m *Model) SetHeight(height int) { + m.Height = height + if m.max > m.Height-1 { + m.max = m.min + m.Height - 1 + } +} + // Update handles user interactions within the file picker model. func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) { switch msg := msg.(type) {