fix: ensure a final render before a clean shutdown

Fixes #274.
This commit is contained in:
Christian Muehlhaeuser 2022-10-12 05:39:30 +02:00
parent 99ad2eda0d
commit a520b7f4e1
1 changed files with 3 additions and 0 deletions

3
tea.go
View File

@ -459,6 +459,9 @@ func (p *Program) Run() (Model, error) {
killed := p.ctx.Err() != nil killed := p.ctx.Err() != nil
if killed { if killed {
err = ErrProgramKilled err = ErrProgramKilled
} else {
// Ensure we rendered the final state of the model.
p.renderer.write(model.View())
} }
// Tear down. // Tear down.