fix: use WithAltScreen instead of deprecated EnterAltScreen

This commit is contained in:
Maas Lalani 2022-08-04 11:21:51 -04:00
parent b8669c420b
commit 35e044d140
No known key found for this signature in database
GPG key ID: 5A6ED5CBF1A0A000

View file

@ -35,6 +35,11 @@ func (o Options) Run() error {
choices = files.List()
}
options := []tea.ProgramOption{tea.WithOutput(os.Stderr)}
if o.Height == 0 {
options = append(options, tea.WithAltScreen())
}
p := tea.NewProgram(model{
choices: choices,
indicator: o.Indicator,
@ -45,11 +50,7 @@ func (o Options) Run() error {
matchStyle: o.MatchStyle.ToLipgloss(),
textStyle: o.TextStyle.ToLipgloss(),
height: o.Height,
}, tea.WithOutput(os.Stderr))
if o.Height == 0 {
p.EnterAltScreen()
}
}, options...)
tm, err := p.StartReturningModel()
m := tm.(model)