mirror of
https://github.com/taigrr/bubbletea.git
synced 2026-04-02 02:59:09 -07:00
Add cmds for toggling mouse mode + deprecate equivalent Program methods
Also automatically disable mouse mode on exit.
This commit is contained in:
@@ -11,14 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
p := tea.NewProgram(model{})
|
||||
|
||||
p.EnterAltScreen()
|
||||
defer p.ExitAltScreen()
|
||||
p.EnableMouseAllMotion()
|
||||
defer p.DisableMouseAllMotion()
|
||||
|
||||
if err := p.Start(); err != nil {
|
||||
if err := tea.NewProgram(model{}).Start(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
@@ -29,7 +22,7 @@ type model struct {
|
||||
}
|
||||
|
||||
func (m model) Init() tea.Cmd {
|
||||
return nil
|
||||
return tea.Batch(tea.EnterAltScreen, tea.EnableMouseAllMotion)
|
||||
}
|
||||
|
||||
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
|
||||
Reference in New Issue
Block a user