mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-05 04:36:07 +00:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user