Skip to content

Commit

Permalink
chore: start program with alt screen instead of init
Browse files Browse the repository at this point in the history
As described by the `tea.EnterAltScreen` godocs, the correct way is to initialize the program with the `tea.WithAltScreen`
  • Loading branch information
Jay Morelli authored and Jay Morelli committed Aug 15, 2023
1 parent 91dd120 commit e7101c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/list-fancy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func newModel() model {
}

func (m model) Init() tea.Cmd {
return tea.EnterAltScreen
return nil
}

func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
Expand Down Expand Up @@ -183,7 +183,7 @@ func (m model) View() string {
func main() {
rand.Seed(time.Now().UTC().UnixNano())

if _, err := tea.NewProgram(newModel()).Run(); err != nil {
if _, err := tea.NewProgram(newModel(), tea.WithAltScreen()).Run(); err != nil {
fmt.Println("Error running program:", err)
os.Exit(1)
}
Expand Down

0 comments on commit e7101c1

Please sign in to comment.