From 5383f5a61e34bd76bbe107ddc0dfd284dc788fe3 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Sat, 1 Feb 2020 21:02:12 -0500 Subject: [PATCH] Wrap termenv altscreen functions to make things simpler for the end user --- examples/fullscreen/main.go | 5 ++--- tea.go | 12 ++++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/examples/fullscreen/main.go b/examples/fullscreen/main.go index 6774b55..2d526a5 100644 --- a/examples/fullscreen/main.go +++ b/examples/fullscreen/main.go @@ -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) diff --git a/tea.go b/tea.go index 602b8a0..afd2a20 100644 --- a/tea.go +++ b/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() +}