Skip to content

Releases: charmbracelet/bubbletea

v0.24.0

08 May 17:44
v0.24.0

Choose a tag to compare

It is finally time for another Bubble Tea release!

This release contains 31 commits by 14 contributors. Thank you everyone! 💕

Without further ado, here's a list of the most important changes:

Message handling and filtering

The tea.QuitMsg is now exported and you can use tea.WithFilter to filter which messages your model will receive:

func filter(m tea.Model, msg tea.Msg) tea.Msg {
  if _, ok := msg.(tea.QuitMsg); !ok {
      return msg
  }

  model := m.(myModel)
  if model.hasChanges {
      return nil
  }

  return msg
}

p := tea.NewProgram(Model{}, tea.WithFilter(filter));

if _,err := p.Run(); err != nil {
  fmt.Println("Error running program:", err)
  os.Exit(1)
}

Testing

We are introducing an our very own /x package, which contains the teatest package.

With teatest, you can easily run a tea.Program, assert its final model and/or output.

This package required a couple of new methods on Bubble Tea, namely Program.Wait(), WithoutSignals.

You can see an example usage in the simple example.

Bug fixing

We try hard to not let any of them pass, but we know, sometimes a few of them do. This release also gets rid of a bunch of them.

What's Changed

New Contributors

Full Changelog: v0.23.2...v0.24.0


The Charm logo

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

v0.23.2

08 Feb 15:23

Choose a tag to compare

Hello Bugfixes

This is a small maintenance release with two small but acute fixes from our wonderful community. Thanks for the support! 💘

Fixed

  • Ensure Msg Cmd is not nil before invoking (to avoid a nil pointer exception) by @nderjung in #640
  • Add support for BatchMsg to Sequence by @stoffeastrom in #581

The Charm logo

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

v0.23.1

15 Nov 15:14
94d6f50

Choose a tag to compare

This bugfix release addresses an issue that was introduced by v0.23.0 and prevented programs from re-using stdin after a tea.Program had finished execution.


Changelog

Fixed!


The Charm logo

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

v0.23.0

09 Nov 17:24

Choose a tag to compare

If you are closely following Bubble Tea's development, you may have already noticed that we have been really busy fixing a lot of issues and merged more than just a couple of feature requests in recent weeks. This v0.23.0 release is in fact our biggest update since the initial release of the package: in the last 3 months over 100 commits have reached us by more than 30 individual contributors! Thank you everyone! 💕

Here's a quick overview of what has changed:

Custom Outputs

Don't want to render your beautiful TUI to stdout? A buffer or an alternative file descriptor like stderr seems more
appropriate? We got you covered now:

Render to stderr

p := tea.NewProgram(model, tea.WithOutput(os.Stderr))

Render to a Buffer

var buf bytes.Buffer
p := tea.NewProgram(model, tea.WithOutput(&buf))

Run Like the Wind

We've introduced the aptly named method Program.Run which replaces and deprecates the existing Program.Start and
Program.StartReturningModel methods. This unifies and clarifies the blocking behavior of the Bubble Tea program execution.

The old methods will continue to work for now, but please update your programs accordingly:

p := tea.NewProgram(model, tea.WithOutput(os.Stderr))
model, err := p.Run() // instead of p.Start or p.StartReturningModel
...

Bug Fix Galore!

The initialization and tear-down methods of tea.Program have been revised and some long-standing problems have been resolved. We couldn't list every single fix in the release notes, so please check out the full changelog below!

🤗 Thanks

We would like to particularly thank @knz who is the sole author of more than a dozen PRs since the last release. Outstanding work!


Changelog

New

  • Render to custom outputs, io.Writers and buffers (tea.WithOutput)
  • Support for new keys: Ctrl(+Alt) - Page, Home, End, and Insert keys
  • Signal handler is optional with program option tea.WithoutSignalHandler
  • tea.ClearScreen, tea.ShowCursor commands
  • Exported BatchMsg

Fixed!

  • Race conditions in console renderer
  • Issues restoring terminal state on shutdown
  • Kill not resulting in an error returned by Program.Run
  • Repaint behavior
  • Skip over unrecognized CSI sequences
  • Function keys on urxvt
  • Function keys on Linux console
  • Rendering issues with overflowing output buffers
  • Ensure final render on clean shutdown
  • Cursor visibility on altscreen state switch
  • Deadlock in Program.Send on shutdown

Deprecated

  • Program.Start, Program.StartReturningModel: please use Program.Run

The Charm logo

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

v0.22.1

19 Aug 20:15
31800cd

Choose a tag to compare

Mutli-Byte Character Support on Windows

This is a small release with a big impact for Chinese, Japanese, and Korean users on Windows. The long as short of it is that if you’re using a multi-byte character set that’s not UTF-8, Bubble Tea will covert stuff for you so things work as expected. For details see #343.

🤗 Enormous thanks to @mattn for the contribution as well as his Go libraries that make CJK support in the Charm ecosystem possible.

👾 Also, thanks to @aklyachkin, if Bubble Tea on AIX is something you want your dream is a now a reality.

Changelog

Full Changelog: v0.22.0...v0.22.1


The Charm logo

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

v0.22.0

27 Jun 20:05
ca32c4c

Choose a tag to compare

Unmanaged Output

Now you can print unmanaged output above your inline applications. This means you can print stuff above your app that won't be cleared on the next render. It’s super useful for cases where you want to build an apt-like package manager.

Let’s Print

This release introduces two new Cmds that print output above your inline Bubble Tea program:

tea.Println("Hello, Bubble Tea")
tea.Printf("%s, %s", "Hello", "Bubble Tea")

Use it anytime you want to add log-type info to the terminal’s scrollback buffer, such as building your own package manager 📦. And keep in mind that these methods are no-op’s in altscreen mode.

Package Manager Demo

For details see the full example and the docs.

🤗 Thanks

@fiws has been bugging us to implement this forever and then @Adjective-Object swooped in and did it with style and grace! It’s been a great collaboration all around.


Changelog

New

Fixed!

  • Race condition on repaint by @georgijd in #330
  • Handle batched key msgs by @muesli in #326

New Contributors

Full Changelog: v0.21.0...v0.22.0


The Charm logo

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

v0.21.0

02 Jun 00:34
775dbfb

Choose a tag to compare

Spawn Interactive Processes + More Keybindings

Finally! This update allows you to run blocking, interactive processes from Bubble Tea like vim, htop, curl, and even entire shells like fish. It also adds a bunch of new keybindings. Read on for more!

Let’s Exec

As we were saying, you can now spawn interactive processes in the terminal from Bubble Tea and resume Bubble Tea when they exit. For example, you could have your Bubble Tea program spawn vim to edit a file, or temporarily open a shell, like fish. Here’s what it looks like:

type editorFinishedMsg struct{ err error }

func openInVim(path string) tea.Cmd {
	c := exec.Command("vim", path)
	return tea.ExecProcess(c, func(err error) tea.Msg {
		return editorFinishedMsg{err}
	})
}

See the full example for details.

Keys Galore

Prior to this update, you couldn't bind to the functions keys. Isn't that crazy? @mrusme certainly thought so. With this update you can can now respond to F1 through F20, modifiers included.

And thanks to @Bwahharharrr you can also now bind to arrow keys with the ctrl, shift and alt modifiers.


High-Level Changelog

New

  • move cancelreader into a separate package by @muesli in #222
  • Exec, program.ReleaseTerminal and RestoreTerminal to re-use input and terminal by @muesli in #237
  • add support for shift/ctrl + arrow keys by @meowgorithm in #292
  • add function key support by @meowgorithm in #263

Changed

New Contributors

Full Changelog: v0.20.0...v0.21.0


The Charm logo

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

v0.20.0

15 Feb 15:41

Choose a tag to compare

Force Kill, Bugfixes, and Small Improvements

This is mostly a bugfix release, but there’s also a new feature where you can quit a Bubble Tea program immediately, skipping the final render, but still restoring the terminal state:

p := tea.NewProgram(model{})

go func() {
    if err := p.Start(); err != nil {
        fmt.Println("Oh no:", err)
        os.Exit(1)
    }
}()

// Later
p.Kill()

This can be useful in when to you need fine-grained management over a Bubble Tea program when using something like Wish. Special thanks to @aymanbagabas for implementing this swiftly and acutely.

New

  • Added Kill() method to force quit the program and restore terminal state #219
  • Support batched mouse events #215 (see #212 for details)

Fixed

  • Allocate msgs channel in constructor to fix a data race (thanks @paralin!) #180
  • Handle nil cmds in tea.Sequentially (thanks @ajeetdsouza!) #214
  • tea.Batch now returns nil if all cmds are nil #217
  • Don't check terminal size if output is not a terminal #228

New Contributors

Full Changelog: v0.19.3...v0.20.0


The Charm logo

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

v0.19.3

07 Jan 18:46

Choose a tag to compare

Altscreen Repaints

This release fixes a small bug where views would render blank if the view’s return value didn’t change after toggling the altscreen.

🤗 Special thanks to @chris-miner for flagging this one.


The Charm logo

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

v0.19.2

17 Dec 17:18

Choose a tag to compare

It’s all about BSD

This release restores support for Dragonfly BSD and fixes a bug where general BSD builds would fail with Go 1.17. BSD users, let us know if you notice anything else is awry.


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

The Charm logo