mirror of
https://github.com/taigrr/bubbletea.git
synced 2026-04-02 11:09:17 -07:00
Wrap termenv altscreen functions to make things simpler for the end user
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/charmbracelet/tea"
|
||||
"github.com/muesli/termenv"
|
||||
)
|
||||
|
||||
type model int
|
||||
@@ -16,8 +15,8 @@ type model int
|
||||
type tickMsg struct{}
|
||||
|
||||
func main() {
|
||||
termenv.AltScreen()
|
||||
defer termenv.ExitAltScreen()
|
||||
tea.AltScreen()
|
||||
defer tea.ExitAltScreen()
|
||||
err := tea.NewProgram(initialize, update, view, subscriptions).Start()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
||||
12
tea.go
12
tea.go
@@ -269,3 +269,15 @@ func (p *Program) processSubs(msgs chan Msg, activeSubs subManager) subManager {
|
||||
|
||||
return activeSubs
|
||||
}
|
||||
|
||||
// AltScreen exits the altscreen. Just is just a wrapper around the termenv
|
||||
// function
|
||||
func AltScreen() {
|
||||
termenv.AltScreen()
|
||||
}
|
||||
|
||||
// ExitAltScreen exits the altscreen. Just is just a wrapper around the termenv
|
||||
// function
|
||||
func ExitAltScreen() {
|
||||
termenv.ExitAltScreen()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user