💄 fix(ui): add newline when quitting

This commit is contained in:
punkfairie 2024-09-07 16:34:18 -07:00
parent 82e585c5a5
commit b543e458b3

10
main.go
View file

@ -24,6 +24,7 @@ type menu struct {
help help.Model
inputStyle gloss.Style
spinner spinner.Model
quitting bool
}
func initialModel() menu {
@ -36,6 +37,7 @@ func initialModel() menu {
keys: keys,
help: help.New(),
spinner: s,
quitting: false,
}
}
@ -165,6 +167,7 @@ func (m menu) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case tea.KeyMsg:
switch msg.String() {
case "ctrl+c", "q":
m.quitting = true
return m, tea.Quit
}
@ -220,7 +223,12 @@ func (m menu) View() string {
helpView := m.help.View(m.keys)
page := gloss.JoinVertical(gloss.Left, content, helpView)
last := ""
if m.quitting {
last = "\n"
}
page := gloss.JoinVertical(gloss.Left, content, helpView, last)
return gloss.PlaceHorizontal(width, gloss.Center, page)
}