A powerful little TUI framework 🏗
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.
This release introduces two new Cmd
s 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.
For details see the full example and the docs.
@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.
Full Changelog: https://github.com/charmbracelet/bubbletea/compare/v0.21.0...v0.22.0
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or Slack.
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!
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.
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.
KeySpace
by @bashbunni in https://github.com/charmbracelet/bubbletea/pull/289 and https://github.com/charmbracelet/bubbletea/pull/315
Full Changelog: https://github.com/charmbracelet/bubbletea/compare/v0.20.0...v0.21.0
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or Slack.
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.
Kill()
method to force quit the program and restore terminal state https://github.com/charmbracelet/bubbletea/pull/219
nil
cmds in tea.Sequentially
(thanks @ajeetdsouza!) https://github.com/charmbracelet/bubbletea/pull/214
tea.Batch
now returns nil
if all cmds are nil https://github.com/charmbracelet/bubbletea/pull/217
Full Changelog: https://github.com/charmbracelet/bubbletea/compare/v0.19.3...v0.20.0
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or Slack.
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.
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or Slack.
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.
This update fixes a regression introduced in v0.16.0 that prevented Bubble Tea from building on BSD systems (excluding Darwin).
Here’s the changelog.
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter or The Fediverse.
This release features Program.StartReturningModel
, a handy alternative start method for returning the final Model
after a Program
exits. This makes it easy to access data collected in a Bubble Tea program while still working in an immutable fashion.
Here’s an example illustrating how it works:
type MyModel struct {
Name string
FaveCatColor string
}
p := tea.NewProgram(MyModel{})
// Return the final model when we're done
finalModel, err := p.StartReturningModel()
if err != nil {
fmt.Println("Uh oh", err)
os.Exit(1)
}
// The final model is a generalized tea.Model, so be sure to assert it into
// your actual model type.
if m, ok := finalModel.(MyModel); ok {
fmt.Printf("Hello, %s. I have a %s kitty for you.\n", m.Name, m.FaveCatColor)
}
🤗 A big thanks to @Raphexion for both conceptualizing and executing this feature.
We’ve also made the ANSI compressor opt-in by default as we noticed that it was incurring a larger performance hit than we’d like in some cases. To enable the ANSI compressor just use the WithANSICompressor
program option:
tea.NewProgram(model, tea.WithANSICompressor())
Here’s the full changelog for this release.
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter or The Fediverse.
The big news in this release is the integration of @muesli’s ANSI compressor from his new ANSI package. The compressor, which has been integrated into the renderer, automatically removes redundant ANSI sequences and, as such, it can be considered lossless. This should improve rendering speeds both locally and over the wire.
Program.Quit()
helper function as acutely suggested by @aymanbagabasWhen quitting a Bubble Tea program from the outside you previously had to…
p.Send(tea.Quit())
…which works, but also feels a little silly. So now you can just…
p.Quit()
Here’s the full changelog.
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter or The Fediverse.
This release adds mouse support in Windows! It also fixes a regression introduced in v0.16.0
where the arrow keys didn't work on Windows.
As a side effect to the above, cancelable reads have been disabled in Windows for now. This means applications running in Windows can not run multiple Program
s in succession in the context of a single application, nor can user input be reliably read after a Program
has exited until the Go application exits. This is temporary and a solution is in development.
v0.16.0
. This will be addressed in a subsequent release.Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter or The Fediverse.
This release implements a cancelable input reader which allows user input to be read after a Program
has exited. This means that you can now run multiple Program
s in succession in a single application as well as generally read user input in other after a Program
has exited in the context of a single application.
In addition, all Goroutines are now gracefully terminated before Program.Start()
returns, resulting in reliable behavior between subsequent Program
s.
This update has been a major undertaking by @erikgeiser, who built specific implementations for Linux, BSD/macOS, and Windows as well as a general purpose implementation for other flavors of unix.
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter or The Fediverse.