Releases: charmbracelet/bubbletea
v0.26.0
Bracketed Paste, Windows Improvements, Mainframes, and more
What do tapioca balls, IBM mainframes, and the Microsoft Windows Console API have in common? Bubble Tea v0.26.0, thatโs what. Letโs get to it.
โก๏ธ Windows Input Improvements
A few years ago @erikgeiser, a penetration tester and ex-particle physicist, wrote this awesome library called coninput to majorly improve Bubble Tea input on Windows. @aymanbagabas has implemented the library in Bubble Tea and input on Windows is roughly 1000 times better now. In the short term, this means that for Windows users inputting non-Latin characters (like Greek, Cyrillic, Korean, Chinese and so on) stuff will โjust work.โ
The bigger news, however, is that this paves the way for Windows parity with our forthcoming support for super high fidelity input via Kitty Keyboard and Fixterms.
๐ณ Hot Windows Resize Events
Terminal emulators on Windows donโt support the SIGWINCH
signal, which is sent when the terminal is resized. Itโs been a huge bummer for a really long time. Thanks (again) to @erikgeiser and @aymanbagabas, weโre now able to reach deep into Windowsโ underpinnings, detect window resizes, and send tea.WindowSizeMsg
s accordingly! This is a glorious moment for Bubble Tea on Windows indeed.
๐ซ Bracketed Paste
While building a query editor for a CockroachDB client, @knz noticed that Bubble Tea didn't support Bracketed Paste. Performance-wise, that sucks because it means pasting large bodies of text (like SQL queries) will normally be seen as a bunch of little successive keypresses. Thatโs where Bracketed Paste comes in. When enabled at the terminal-level Bracketed Paste lets you slam down a bunch of text with one big, fat input event.
Bubble Tea enables bracketed paste by default, however you can opt out of it with the WithoutBracketedPaste()
program option:
p := tea.NewProgram(myCuteModel, tea.WithoutBracketedPaste())
You can also enable and disable it on demand with the EnableBracketedPaste()
and DisableBracketedPaste()
commands.
๐ฟ Multiline tea.Println
In case you forgot, tea.Println
(and itโs brother tea.Printf
) is a Cmd
that lets you print unmanaged output above a Bubble Tea program, similar to what you see with package managers like apt-get
. Thanks to @Adjective-Object (who also implemented tea.Println
in the first place) now you can send multi-line output, too. For a tea.Println
refresher see the package manager example.
๐ Hello, z/OS
Donโt you think itโs about time we all ran Bubble Tea apps on our mainframes? Thanks to @dustin-ward that dream is now a reality, so long as you have a z/OS mainframe. We're thrilled to announce that Bubble Tea is now fully supported on z/OS.
๐น Bug fixes
Bugfixes are the unsung heroes that sometimes get buried below the feature listings. This release has them and theyโre good ones; see the changelog below for details.
Changelog
New!
- bracketed paste by @knz in #397
- use windows console input buffer + resize events on windows by @aymanbagabas in #878
- multiline
tea.Println()
messages by @Adjective-Object in #490 - z/OS support by @dustin-ward in #913
Changed
Fixed
- fix deadlock condition on model init panic by @eolso in #926
- reduce console/term dependencies by @aymanbagabas in #897
- optimize batches with one item by @systay in #875
New Contributors
- @kevgo made their first contribution in #893
- @canack made their first contribution in #890
- @Pheon-Dev made their first contribution in #621
- @rusinikita made their first contribution in #835
- @hedhyw made their first contribution in #864
- @mat2cc made their first contribution in #871
- @stefanlogue made their first contribution in #855
- @BigJk made their first contribution in #885
- @sharunkumar made their first contribution in #839
- @timmattison made their first contribution in #908
- @dustin-ward made their first contribution in #913
- @jaymorelli96 made their first contribution in #802
- @siddhantac made their first contribution in #906
- @taigrr made their first contribution in #853
- @systay made their first contribution in #875
- @gabe565 made their first contribution in #728
- @zMoooooritz made their first contribution in #902
- @j178 made their first contribution in #709
- @arisnacg made their first contribution in #948
- @braheezy made their first contribution in #950
- @dhth made their first contribution in #949
- @tearingItUp786 made their first contribution in #944
- @aschey made their first contribution in #597
- @petergloor made their first contribution in #955
- @kaifulee made their first contribution in #957
- @danenania made their first contribution in #971
- @cuibuwei made their first contribution in #977
- @agvxov made their first contribution in #972
- @eolso made their first contribution in #926
Full Changelog: v0.25.0...v0.25.1
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or Discord.
v0.25.0
Major mouse improvements, better input parsing, and lots more!
We hope youโre ready for winter. Unless youโre in the southern hemisphere (like @caarlos0) in which case, we hope youโre ready for summer. In either case, we hope you have a happy new year if the Julian calendar is something youโre into.
There are a bunch of good features in this release and a ton of input-related improvements. Read on for more!
Extended Mouse Mode
Bubble Tea now supports Extended Mouse Mode (aka SGR mode) which makes now mouse support in Bubble Tea way, way better.
Prior to this release Bubble Tea used the X10 mouse protocol. X10 was last released in 1986: a time when screen resolutions were smaller, memory limits were low, and a terminal sizes were tiny. For terminals and mice this meant that the mouse tracking stopped after the 127th horizontal cell. Well, thanks to the elite abilities of @aymanbagabas Bubble Tea can now track mouse movements across the entire terminal window, no matter how enormous.
And that's not all: Bubble Tea now has higher fidelity access to mouse operations such as shift, ctrl, and alt modifiers, mouse button release events, and a big range of mouse button and mouse wheel events.
For details see the docs for the new and improved MouseEvent
.
Setting the Window Title
@aymanbagabas also wanted to be able to set the terminal window title with Bubble Tea, so he added the SetWindowTitle
Cmd
. Now setting the window title is as simple as:
func (m Model) Update(msg tea.Msg) (tea.Model. tea.Cmd) {
return m, tea.SetWindowTitle("oh my")
}
FPS Control
Have you ever thought โBubble Tea is too fast and I just canโt handle it?โ Or perhaps 60fps is too slow and you want to go full 120fps. Now, thanks to @tomfeiginโs WithFPS
ProgramOption
you can:
// Letโs go with the classic soap opera frame rate
p := tea.NewProgram(model, tea.WithMaxFPS(45))
Better Input, Better Living
@knz is just incredible. He took a look at Bubble Teaโs input parser and whipped it into shape with what felt like a flick of the wrist. Keyboard input is now more efficient than ever and very large amounts of input can be parsed with the greatest of ease. It's hard to overstate how impactful his contributions areโand there are more in the pipe.
Changelog
New!
- Extended Coordinates mouse reporting and additional button support by @aymanbagabas in #594
- Option to set max FPS by @tomfeigin in #578
SetWindowTitle
command by @aymanbagabas in #611
Fixed
- Invert the key parsing control loop by @knz in #569
- Simplify the key input analysis code by @knz in #568
- Support very long buffered input in key parsing by @knz in #570
- Make
ReleaseTerminal
/RestoreTerminal
thread safe by @caarlos0 in #791
Full Changelog: v0.24.2...v0.25.0
New Contributors
- @tomfeigin made their first contribution in #578
- @bloznelis made their first contribution in #763
- @grafviktor made their first contribution in #770
- @naglis made their first contribution in #787
- @grrlopes made their first contribution in #804
- @Juneezee made their first contribution in #812
- @ddworken made their first contribution in #828
- @wI2L made their first contribution in #829
- @guyfedwards made their first contribution in #865
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or Discord.
v0.24.2
This point release fixes a race condition that could occur when stopping the default renderer:
Full Changelog: v0.24.1...v0.24.2
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or Discord.
v0.24.1
You can pipe again
This point release fixes a regression introduced in v0.24.0
in which keyboard and mouse input would be lost when piping and redirecting into a program with default inputs. Special thanks to @pomdtr forโฆpiping up about the regression.
- fix: auto-open a TTY when stdin is not a TTY (regression) by @meowgorithm in #746
Full Changelog: v0.24.0...v0.24.1
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or Discord.
v0.24.0
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
- feat: LogToFileWith by @caarlos0 in #692
- feat: add generic event filter by @muesli in #536
- feat(deps): bump golang.org/x/text from 0.3.7 to 0.3.8 by @dependabot in #674
- feat(ci): auto go mod tidy examples by @caarlos0 in #561
- feat: tea.Wait by @caarlos0 in #722
- feat: allow to disable signals by @caarlos0 in #721
- fix: Check if program cancelReader is is nil before invoking by @nderjung in #643
- fix: renderer only stops once by @muesli in #685
- fix: stop renderer before launching a child process. by @muesli in #686
- fix(output): reuse termenv output by @aymanbagabas in #715
- chore: make input options mutually exclusive by @meowgorithm in #734
- chore: bump console dep by @muesli in #700
- chore(deps): bump actions/setup-go from 3 to 4 by @dependabot in #701
- chore: bump termenv, lipgloss, x/term by @muesli in #711
- docs: using the x/exp/teatest package by @caarlos0 in #352
- docs: fix portal markdown URL syntax by @mjmammoth in #669
- docs: fix typos and clean up comments by @gzipChrist in #672
- docs: countdown to Bubble Tea in the Wild by @aldernero in #679
- docs: issue template by @caarlos0 in #389
- docs: update issue templates by @bashbunni in #712
- docs: remove british spelling by @bashbunni in #719
- docs: add WG Commander to README.md by @AndrianBdn in #667
- docs: filepicker Example by @maaslalani in #683
- docs(README): add eks-node-viewer to "Bubble Tea in the Wild" list by @Nezz7 in #619
New Contributors
- @mjmammoth made their first contribution in #669
- @gzipChrist made their first contribution in #672
- @Nezz7 made their first contribution in #619
- @AndrianBdn made their first contribution in #667
- @aldernero made their first contribution in #679
Full Changelog: v0.23.2...v0.24.0
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or Discord.
v0.23.2
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
toSequence
by @stoffeastrom in #581
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or Discord.
v0.23.1
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!
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or Discord.
v0.23.0
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 useProgram.Run
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or Discord.
v0.22.1
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
- support multi-byte strings on Windows by @mattn in #343
- enable compilation on AIX by @aklyachkin in #381
Full Changelog: v0.22.0...v0.22.1
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or Slack.
v0.22.0
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 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.
๐ค 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
- Credit card input form example by @maaslalani in #338
- Allow unmanaged output above the app in standard renderer by @Adjective-Object in #249
Fixed!
New Contributors
- @georgijd made their first contribution in #330
- @joaom00 made their first contribution in #313
- @maaslalani made their first contribution in #338
- @Adjective-Object made their first contribution in #249
Full Changelog: v0.21.0...v0.22.0
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or Slack.