Skip to content

Commit

Permalink
fix(filepicker): auto-height
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Alexandro Becker <[email protected]>
  • Loading branch information
caarlos0 committed Nov 15, 2024
1 parent 1696347 commit 8bf52a4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
22 changes: 22 additions & 0 deletions examples/filepicker-picking/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package main

import (
"fmt"

"github.com/charmbracelet/huh"
)

func main() {
var file string
huh.NewForm(
huh.NewGroup(
huh.NewFilePicker().
Picking(true).
Title("Code").
Description("Select a .go file").
AllowedTypes([]string{".go"}).
Value(&file),
),
).WithShowHelp(true).Run()
fmt.Println(file)
}
2 changes: 0 additions & 2 deletions field_filepicker.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ type FilePicker struct {
func NewFilePicker() *FilePicker {
fp := filepicker.New()
fp.ShowSize = false
fp.AutoHeight = false

if cmd := fp.Init(); cmd != nil {
fp, _ = fp.Update(cmd())
Expand Down Expand Up @@ -151,7 +150,6 @@ func (f *FilePicker) Height(height int) *FilePicker {
adjust++
}
f.picker.Height = height - adjust
f.picker.AutoHeight = false
return f
}

Expand Down

0 comments on commit 8bf52a4

Please sign in to comment.