fix(deps): update module github.com/charmbracelet/bubbletea to v2 - autoclosed #534
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
v1.2.5-0.20241205214244-9306010a31ee->v2.0.0-beta.1Release Notes
charmbracelet/bubbletea (github.com/charmbracelet/bubbletea)
v2.0.0-beta.1Compare Source
It’s time for Bubble Tea v2 Beta
We're very excited to announce the first beta release of Bubble Tea v2! This release includes a number of improvements and features over the last alpha 2 release.
🍔 New to v2? Looking to upgrade? Check out the full Bubble Tea v2 guide.
Changes Since Alpha 2
Since the last alpha 2 release, we've made a few changes and added some new features. Including restoring old
Initbehavior, actual cursor support, and some minor API name changes.Init and Model Changes
We restored the old
tea.Modelinterface andInitmethod changes. Now,Initreturns atea.Cmdas what it was before. The thought here is that it's more ergonomic and returning atea.Modeldoesn't make much sense because duringInityou already have a newly created model.Cursor Support and View Interfaces
Yes, finally, you can control the cursor! We've added a new
tea.CursorViewinterface that you can implement to control the cursor position and style. This is a long-awaited feature, and we're excited to see what you do with it.Originally,
tea.Modelimplemented aViewmethod that returned astring. We changed this to be in its owntea.ViewModelinterface and took it out oftea.Model. Nowtea.Modelonly hasUpdateandInitmethods. Not implementing aViewmethod is equivalent to disabling rendering. Both new interfaces are optional. The difference is thattea.CursorModelreturns atea.Cursoralong with a string to control the cursor.Enhanced Keyboard Support
Terminologies matter. Previously, we introduced
tea.EnableKeyboardEnhancementsto request different keyboard enhancement features. We've renamed this totea.RequestKeyboardEnhancementto signal that the program is requesting keyboard enhancements from the terminal and the terminal may or may not support them.Like details?
Here’s the full changelog since v2.0.0-alpha.2
🌈 Feedback
Have thoughts on Bubble Tea v2 Alpha? We’d love to hear about it. Let us know on…
Part of Charm.
Charm热爱开源 • Charm loves open source • نحنُ نحب المصادر المفتوحة.
v2.0.0-alpha.2Compare Source
Are you excited about another alpha release?
We know we are! This release is chock full of features and improvements.
If you’re new to Bubble Tea v2 we recommending taking a look at the
v2.0.0-alpha.1release notes as well.If you're already using
v2.0.0-alpha.1there's nothing new to do forv2.0.0-alpha.2. You can blissfully ignore everything below and gleefully reap the benefits…but don't you want to know what’s new?Let's dive in!
🚚 Packages
This release was designed to work with Bubble Tea, Bubbles, and Lip Gloss v2 alphas with the same tag, so make sure you catch ’em all:
🎩 Better Windows Input Support
We take Windows support seriously, and with this release, we've revamped the
Windows input handling. Now, Bubble Tea works even better on Windows.
Bubble Tea now takes advantage of the Windows Console API to
get the terminal's size, focus events, and advanced keyboard and mouse
handling. This won't interfere with the existing escape sequence handling, so
you can still use the same code across different platforms.
🪄 Program-level Color Profiles and Styles
Bubble Tea now automatically downsamples ANSI, when necessary, for the appropriate output. For example, if you're setting 24-bit (TrueColor) colors in your application, and the user is using Apple Terminal, the colors will be automatically downsampled to the nearest colors in the 256 color spectrum. Or, if output's being directed to a file, colors will be stripped entirely.
Even better, this works with colors and styling generated by anything, not just Lip Gloss.
That means you can flow in ANSI styling from any tool or library and rest assured that colors
will just work with the user's terminal. This is all thanks to our new
magical
colorprofilelibrary.
Detecting the color profile
Need to use the detected color profile in your app? Listen to
tea.ColorProfileMsginUpdate:Manually applying a color profile
What's that you say? You want to manually set a color profile for testing? Now you can, on the program level.
Want to hard detect the color profile in wish? We bet you do.
Going deep
Hungry for more? This is for the more hard core terminal devs, like you.
😮 An Acual Cursor
Another nice feature is the ability to use a real terminal
cursor. If you enable the cursor visibility, you can control the cursor
position and shape in your program.
You can also request the cursor position by using the
tea.RequestCursorPositioncommand.We’re still in the process of integrating true cursor support into
textareaandtextinputin Bubbles, however a true cursor is now at your disposal.🗝️ Uniform Key Handling
One of the biggest changes coming to Bubble Tea v2 is enhanced keyboard
handling. This includes support for more key events, and complex key
combinations, as well as key releases.
When targeting users on different platforms and keyboard layouts, it's
important to have a consistent and reliable way to handle key events. With this
release, you can now use
tea.WithUniformKeyLayoutkeyboard enhancement toensure that your program works as expected across different keyboard layouts.
For example, on a multi-layout QWERTY keyboard, ctrl+a should always
trigger a
ctrl+aevent, regardless of the layout language. Similarly, shift+h should send ashift+hevent with the letterHas itsprintable value. But what happens when you press shift+h in a
different QWERTY layout?
Let's take the PC-101 QWERTY Arabic layout as an example. In this layout, shift+h corresponds to the Arabic letter
أ. If you're building agame or an application that relies on key events where you don't really care
about the actual printable value of the key press, you'd want to ensure that shift+h always sends a
shift+hevent despite the layout language.This will also respect the keyboard layout and send the correct printable
value for the key press. For example, on a US QWERTY keyboard, ctrl+a
corresponds to the first letter on the second row of the keyboard. On a French
AZERTY keyboard, the same key combinations correspond to ctrl+q.
To achieve this, you can use the
tea.WithUniformKeyLayoutoption and let BubbleTea handle the rest.
💬 Requesting Terminal Properties
With this release, we made it explicit how to request terminal properties. Use
the
tea.Request...commands to get the terminal's size, background color,foreground color, etc.
The following
Cmds are now at your disposal:tea.RequestBackgroundColor(sends atea.BackgroundColorMsg)tea.RequestForegroundColor(sends atea.ForgroundColorMsg)tea.RequestCursorColor(sends atea.CursorColorMsg)tea.RequestWindowSize(sends atea.WindowSizeMsg)tea.RequestCursorPosition(sends atea.CursorPostionMsg)🍇 Grapheme Clustering
Grapheme what? In short, grapheme clustering is a way to handle Unicode text
segmentation and boundaries. It's useful when you want to determine the terminal
cell width a string or a grapheme cluster occupies. The algorithm is defined
in the Unicode Text Segmentation UAX #29.
For example, '🧑🌾' is a single grapheme cluster, but it's made up of 3
UTF-8 codepoints. Terminals that support grapheme clustering will treat this as
a 2 cell wide character, while those that don't might treat it as 2, 4, 5, or
even 6 cells wide. Our friend Mitchell Hashimoto has a great blog post on this
topic: Grapheme Clusters and Terminal Emulators.
We've added grapheme clustering and mode 2027 support in the previous alpha.1
release, and it was on by default. We've noticed that some terminals, like
Apple Terminal, don't play well with this feature. Specifically, with the
DECRQMcontrol sequence. Not cool.Now we're making the feature opt-in and off by default. You can still enable it by
using the
tea.WithGraphemeClusteringoption.Want to learn more about grapheme clusters? Mitchell Hashimoto has a great post about it.
Changelog
New Contributors
Full Changelog: charmbracelet/bubbletea@v2.0.0-alpha.1...v2.0.0-alpha.2
🌈 Feedback
Have thoughts on Bubble Tea v2 Alpha? We’d love to hear about it. Let us know on…
Part of Charm.
Charm热爱开源 • Charm loves open source • نحنُ نحب المصادر المفتوحة
v2.0.0-alpha.1Compare Source
Who’s ready for Bubble Tea v2 Alpha?
We’re so excited for you to try Bubble Tea v2! Keep in mind that this is an alpha release and things may change.
Here are the the big things to look out for in v2:
Key handling is way better now
We added support for way, way, way better key handling in newer terminals. For example, now you can map to things like shift+enter and super+space, as long as the terminal supports progressive keyboard enhancement. You can also detect key releases too (we're looking at you, terminal game developers).
Init looks more like Update
We changed
Init()’s signature to matchUpdate()to make programs easier to follow and to make swapping models easier.Upgrading
Upgrading to Bubble Tea v2 is easy. Just update your imports and follow the
instructions below.
Init()signatureChange your
Model'sInit()signature to return atea.Modeland atea.Cmd:Why the change?
Now you can use
Initto initialize theModelwith some state. By following this pattern Bubble Tea programs become easier to follow. Of course, you can still initialize the model before passing it toProgramif you want, too.It also becomes more natural to switch models in
Update, which is a very usefulway to manage state. Consider the following:
While the change to
Init()may seem big, in practice we've found that it doesn't take much to update existing programs.Keyboard enhancements (optional)
With Bubble Tea v2, you can get more out of your terminal. Progressive keyboard enhancements, allow you to use more key combinations. Just use the
tea.WithKeyboardEnhancementsoption when creating a new program to get all the keys, in supported terminals only.You can enable enhanced keyboard support by passing the
tea.WithKeyboardEnhancementsoption totea.NewProgramor by using thetea.EnableKeyboardEnhancementscommand.By default, release events aren't included, but you can opt-into them with the
tea.WithKeyReleasesflag:You can detect if a terminal supports keyboard enhancements by listening for
tea.KeyboardEnhancementsMsgafter enabling progressive enhancements.Which terminals support progressive enhancement?
Key messages
Key messages are now split into
tea.KeyPressMsgandtea.KeyReleaseMsg. Usetea.KeyMsgto match against both.We no longer have
key.Typeandkey.Runesfields. These have been replacedwith
key.Codeandkey.Textrespectively. A key code is just arunethatrepresents the key message. It can be a special key like
tea.KeyEnter,tea.KeyTab,tea.KeyEscape, or a printable rune.The new
key.Textfield signifies a printable key event. If the key event hasa non-empty
Textfield, it means the key event is a printable key event. Inthat case,
key.Codeis always going to be the first rune ofkey.Text.Instead of matching against
msg.Type == tea.KeyCtrl...keys, key modifiersare now part of the key event itself as
key.Mod. Shifted keys now have theirown key code in
key.ShiftedCode. Typing shift+b will producekey.Code == 'b',key.ShiftedCode == 'B',key.Text == "B", andkey.Mod == tea.ModShift.The easiest way to match against key events is to use
msg.String():Oh, and we finally changed space bar to return
"space"instead of" ". Inthis case,
key.Code == ' 'andkey.Text == " ".Paste messages
Bracketed-paste has its own message type now. Use
tea.PasteMsgto matchagainst paste events.
Mouse messages
We've also improved the mouse API, which is a breaking change. Use
tea.MouseMsgto match against different types of mouse events. Mouse messagesare split into
tea.MouseClickMsg,tea.MouseReleaseMsg,tea.MouseWheelMsg,and
tea.MouseMotionMsg.Other new things
Native clipboard support
Bubble Tea now supports native clipboard operations, also known as OSC52.
This means you can even copy and paste over SSH!
X11 and Wayland users can also use
tea.SetPrimaryClipboardto set the primaryclipboard. Note that this is a very niche sort of thing and may or may not
work on macOS, Windows, and other platforms without the notion of more than one
clipboard.
Bracketed-paste messages
Bubble Tea v1 supports bracketed-paste mode by default. It sends paste events
as a
tea.KeyMsgwithmsg.Pasteflag set totrue, which to be honest, waspretty confusing.
In Bubble Tea v2, paste events are sent as their own
tea.PasteMsgmessage. Ifyou don't care about the content and want to listen to paste start/end events,
you can use
tea.PasteStartMsgandtea.PasteEndMsg.Detecting terminal colors
You can now read and set the terminal's foreground, background, and cursor
colors. This is useful for creating advanced terminal applications.
To change the terminal's colors, use
tea.SetForegroundColor,tea.SetBackgroundColor,and
tea.SetCursorColor.Mode 2027 (grapheme clustering)
Most terminals use
wcwidthto calculate the width of characters displayed onthe screen. This becomes a problem when you have characters that are composed
of multiple codepoints, like emojis or characters with diacritics. Mode 2027
tries to solve this issue by informing the terminal that it should use grapheme
clusters instead of codepoints to calculate the width of characters.
In Bubble Tea v2, this feature is enabled by default. It's a no-op on terminals
that don't support it. You can disable it by passing the
WithoutGraphemeClusteringoption.Terminal version and name
Don't know what terminal you're running in?
$TERMis too vague? Bubble Teanow has a
tea.TerminalVersioncommand that queries the terminal for its nameand version using XTVERSION control sequence.
Terminfo and Termcap capabilities
Sometimes you need to know what capabilities the terminal has. Bubble Tea now
has a
tea.RequestCapabilitycommand that queries the terminal for a specificterminfo/termcap capability.
Changelog
New Features
Bug fixes
Documentation updates
Other work
Feedback
Have thoughts on Bubble Tea v2 Alpha? We’d love to hear about it. Let us know on…
Part of Charm.
Charm热爱开源 • Charm loves open source • نحنُ نحب المصادر المفتوحة
v1.3.4Compare Source
This release fixes an issue on Windows where the mouse is always enabled even if it wasn't requested. Now, using mouse options such as
tea.WithAllMouseMotion()and commands such astea.EnableMouseAllMotionandtea.DisableMouseturns the mouse on/off as expected.Changelog
New Features
e817654: feat(ci): move from goveralls to codecov (#1332) (@aymanbagabas)Bug fixes
bf1216d: fix: windows: enable mouse mode on demand (#1340) (@aymanbagabas)Other work
00e3ef4: ci: sync dependabot config (#1328) (@charmcli)4a30f3f: ci: sync dependabot config (#1329) (@charmcli)Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.
v1.3.3Compare Source
This release restore the program options that were deprecated in the previous releases.
Changelog
Full Changelog: charmbracelet/bubbletea@v1.3.2...v1.3.3
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.
v1.3.2Compare Source
Fix canceling terminal input reads on Windows.
Changelog
Bug fixes
b0186ad: fix: windows: handle cancel io error (@aymanbagabas)Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse
Configuration
📅 Schedule: Branch creation - "before 6am on monday" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.