github charmbracelet/bubbletea v2.0.0-beta.2

latest releases: v1.3.8, v1.3.7, v2.0.0-beta.4...
pre-release4 months ago

Extra! Extra! Bubble Tea Beta 2!

We're honing in on v2! This update is fairly minor and makes some adjustments based on the awesome community feedback we've received. Let’s jump into it.

go get github.com/charmbracelet/bubbletea/v2@v2.0.0-beta.2

Keys

Easier Mappings

Thanks to some feedback from our beta users (thank you! ❤️), key events now always return the textual value when using key.String(). You can use key.Keystroke() to get the keystroke string representation of the event. For example, pressing shift+h would give you k.String() == "H" and k.Keystroke() == "shift+h" when keyboard enhancements is on. We believe this will make input handling closer to the good parts of v1 and avoid some gotchas with international keyboards.

// Imagine the user pressed shift+h and key is a KeyMsg
key.String () == "H"
key.Keytroke() == "shift+h"

// Now imagine the user entered a "?"
key.String() == "?"
key.Keytroke() == "shift+/ on an American keyboard, shift+, on a French keyboard"

Other Stuff

  • We reverted the new trailing newline character on program exit. We found that while it's a nice touch that simplifies many programs, it can cause issues for others. This brings rendering in-line with v1, so there will be no action needed migrating from v1
  • Fix concurrency and add deadlock prevention (courtesy @desertwitch)
  • Fixed some examples

Thanks again to @desertwitch for his amazing work on concurrency and deadlock prevention 🤘

Changelog

New Features

Bug fixes

Documentation updates

Other work


The Charm logo

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

Don't miss a new bubbletea release

NewReleases is sending notifications on new releases.