Skip to content

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Sep 13, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
github.com/charmbracelet/bubbletea v1.1.0 -> v1.1.1 age adoption passing confidence

Release Notes

charmbracelet/bubbletea (github.com/charmbracelet/bubbletea)

v1.1.1

Compare Source

Don't panic!

Panicking is a part of life…and a part of workin’ in Go. This release addresses two edge cases where a panic() could tank Bubble Tea and break your terminal:

Panics outside of Bubble Tea

If a panic occurs outside of Bubble Tea you can use Program.Kill to restore the terminal state before exiting:

func main() {
	p := tea.NewProgram(model{})

	go func() {
		time.Sleep(3 * time.Second)
		defer p.Kill()
		panic("Urgh")
	}()

	if _, err := p.Run(); err != nil {
		log.Fatal(err)
	}
}

Panics in Cmds

If a panic occurs in a Cmd Bubble Tea will now automatically restore the terminal to its natural state before exiting.

type model struct{}

// This command will totally panic.
func pancikyCmd() tea.Msg {
	panic("Oh no! Jk.")
}

func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
	switch msg := msg.(type) {
	case tea.KeyMsg:
		switch msg.String() {
		case "enter":
			// Panic time! But everything will be OK.
			return m, pancikyCmd
		}
	}
	return m, nil
}

Happy panicking (if that makes any sense).

Changelog

Fixed!

The Charm logo

Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.


Configuration

📅 Schedule: Branch creation - "before 4pm on friday" in timezone Europe/London, Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot enabled auto-merge (squash) September 13, 2024 03:02
@renovate renovate bot merged commit 5d034fe into main Sep 13, 2024
@renovate renovate bot deleted the renovate/github.com-charmbracelet-bubbletea-1.x branch September 13, 2024 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant