Describe the bug
See the sample program below. It just quits itself after 10ms. I think it quits before ever rendering a real frame. It will print some escape sequences to the terminal then quit.
Setup
- OS: macOS
- Shell: fish, bash, zsh, and nushell: same behavior
- Terminal Emulator: ghostty
To Reproduce
mkdir repro
...save the following test code to main.go
go build .
./repro
Try changing the duration of the tick. On my machine, at 100ms, it doesn't happen, at 10ms it does.
package main
import (
"fmt"
"os"
"time"
tea "charm.land/bubbletea/v2"
)
type quitMsg struct{}
type model struct{}
type TickMsg time.Time
func (m model) Init() tea.Cmd {
return tea.Tick(10*time.Millisecond, func(t time.Time) tea.Msg {
return TickMsg(t)
})
}
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg.(type) {
case quitMsg:
return m, tea.Quit
case TickMsg:
return m, tea.Quit
}
return m, nil
}
func (m model) View() tea.View {
var v tea.View
v.Content = "Loading..."
return v
}
func main() {
p := tea.NewProgram(model{})
if _, err := p.Run(); err != nil {
fmt.Println("Error:", err)
os.Exit(1)
}
}
Describe the bug
See the sample program below. It just quits itself after 10ms. I think it quits before ever rendering a real frame. It will print some escape sequences to the terminal then quit.
Setup
To Reproduce
Try changing the duration of the tick. On my machine, at 100ms, it doesn't happen, at 10ms it does.