Skip to content

Commit

Permalink
fix(file): factor help into height setting (#746)
Browse files Browse the repository at this point in the history
  • Loading branch information
meowgorithm authored Dec 6, 2024
1 parent f3d3b86 commit 09a33c2
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ func (m model) Init() tea.Cmd {

func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.WindowSizeMsg:
if m.showHelp {
m.filepicker.Height -= lipgloss.Height(m.helpView())
}
case tea.KeyMsg:
switch {
// TODO: should this handle q and esc differently than ctrl+c?
Expand Down Expand Up @@ -108,9 +112,9 @@ func (m model) View() string {
if !m.showHelp {
return m.filepicker.View()
}
return lipgloss.JoinVertical(
lipgloss.Top,
m.filepicker.View(),
m.help.View(m.keymap),
)
return m.filepicker.View() + m.helpView()
}

func (m model) helpView() string {
return "\n" + m.help.View(m.keymap)
}

0 comments on commit 09a33c2

Please sign in to comment.