github charmbracelet/bubbletea v0.25.0

latest releases: v2.0.0-alpha.2, v1.2.2, v1.2.1...
11 months ago

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!

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


The Charm logo

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

Don't miss a new bubbletea release

NewReleases is sending notifications on new releases.