This release includes a big change in the module name, and several message type changes. These types changed from type aliases to structs to improve extensibility and allow for future enhancements without breaking changes:
github.com/charmbracelet/bubbletea/v2- now moved tocharm.land/bubbletea/v2CursorPositionMsg- now a struct typeKeyboardEnhancementsMsg- now a struct typePasteMsg- now a struct typeCapabilityMsg- now a struct typeTerminalVersionMsg- now struct types
Migration Guide
Charm Land!
// Before
import tea "github.com/charmbracelet/bubbletea/v2"
// After
import tea "charm.land/bubbletea/v2"Or you can use this GNU sed oneliner in your project root 😉
find . -name \*.go | xargs -I{} sed -i 's/"github.com\/charmbracelet\/bubbletea\/v2"/"charm.land\/bubbletea\/v2"/' {}CursorPositionMsg
// Before
case CursorPositionMsg:
x, y := msg.X, msg.Y
// After (no change needed - fields remain the same)
case CursorPositionMsg:
x, y := msg.X, msg.YKeyboardEnhancementsMsg
// Before
case KeyboardEnhancementsMsg:
if msg&ansi.KittyDisambiguateEscapeCodes != 0 {
// ...
}
// After
case KeyboardEnhancementsMsg:
if msg.Flags&ansi.KittyDisambiguateEscapeCodes != 0 {
// ...
}
// Or use the helper methods:
if msg.SupportsKeyDisambiguation() {
// ...
}PasteMsg
// Before
case PasteMsg:
content := string(msg)
// After
case PasteMsg:
content := msg.Content
// Or use the String() method:
content := msg.String()CapabilityMsg
// Before
case CapabilityMsg:
switch msg {
case "RGB", "Tc":
// ...
}
// After
case CapabilityMsg:
switch msg.Content {
case "RGB", "Tc":
// ...
}
// Or use the String() method:
switch msg.String() {
case "RGB", "Tc":
// ...
}TerminalVersionMsg
// Before
case TerminalVersionMsg:
version := string(msg)
// After
case TerminalVersionMsg:
version := msg.Name
// Or use the String() method:
version := msg.String()Changelog
Docs
- ff8c824: docs(examples): migrate imports to charm.land (@aymanbagabas)
Other stuff
- b947ade: refactor: change several message types to structs for extensibility (@aymanbagabas)
- cc0168c: refactor: migrate imports to charm.land domain (@aymanbagabas)
- b864579: refactor: update module path to charm.land/bubbletea/v2 (@aymanbagabas)
Thoughts? Questions? We love hearing from you. Feel free to reach out on X, Discord, Slack, The Fediverse, Bluesky.