fix(filepicker): height calculations

This commit is contained in:
Maas Lalani
2024-01-29 15:00:43 -05:00
parent d98bf9db0a
commit 01d22a0ab1
+5 -1
View File
@@ -360,7 +360,7 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
// View returns the view of the file picker. // View returns the view of the file picker.
func (m Model) View() string { func (m Model) View() string {
if len(m.files) == 0 { if len(m.files) == 0 {
return m.Styles.EmptyDirectory.String() return m.Styles.EmptyDirectory.Height(m.Height).MaxHeight(m.Height).String()
} }
var s strings.Builder var s strings.Builder
@@ -415,6 +415,10 @@ func (m Model) View() string {
s.WriteRune('\n') s.WriteRune('\n')
} }
for i := lipgloss.Height(s.String()); i <= m.Height; i++ {
s.WriteRune('\n')
}
return s.String() return s.String()
} }