Skip to content
Discussion options

You must be logged in to vote

The "garbage" is almost certainly a leftover escape sequence from the last frame Bubble Tea rendered before it handed control back. Your print code is fine — the fix is to tell Bubble Tea to clear the frame on exit.

Three approaches, increasingly thorough:

1. Return an empty view on quit

If your model has a quitting bool (or similar state), make View() return "" once you've triggered tea.Quit:

func (m AppModel) View() string {
    if m.quitting {
        return ""
    }
    // …your normal rendering
}

func (m AppModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
    // …
    if shouldQuit {
        m.quitting = true
        return m, tea.Quit
    }
}

The Quit command causes one final rend…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by yashranjan1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants