Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions file/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func (o Options) Run() error {
m := model{
filepicker: fp,
padding: []int{top, right, bottom, left},
maxHeight: o.Height,
showHelp: o.ShowHelp,
help: help.New(),
keymap: defaultKeymap(),
Expand Down
5 changes: 3 additions & 2 deletions file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type model struct {
quitting bool
showHelp bool
padding []int
maxHeight int
help help.Model
keymap keymap
}
Expand All @@ -69,11 +70,11 @@ func (m model) Init() tea.Cmd { return m.filepicker.Init() }
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.WindowSizeMsg:
height := msg.Height - m.padding[0] - m.padding[2]
height := m.maxHeight - m.padding[0] - m.padding[2]
if m.showHelp {
height -= lipgloss.Height(m.helpView())
}
m.filepicker.SetHeight(height)
m.filepicker.SetHeight(min(height, msg.Height))
case tea.KeyMsg:
switch {
case key.Matches(msg, keyAbort):
Expand Down