fix(filepicker): properly scrolling filepicker (#753)

* fix(filepicker): properly scrolling filepicker

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: SetHeight

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
Carlos Alexandro Becker
2025-03-20 14:00:29 -03:00
committed by GitHub
parent fff86382cc
commit 54f28b6501
+11
View File
@@ -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) {