Skip to content

Releases: charmbracelet/bubbletea

v0.14.0

02 Jun 19:20
Compare
Choose a tag to compare

Improvements: Races and Rendering

This release introduces three new ProgramOptions for starting programs with the altscreen and mouse enabled. This was implemented to solve both race conditions when initializing programs as well as correctness with regard to custom inputs.

// New! This is the recommended way to start your program with the mouse and altscreen active.
p := tea.NewProgram(model, tea.WithAltScreen(), tea.WithMouseAllMotion())

// Deprecated as this will only operate on stdout, as opposed to a custom output you may have set.
p := tea.NewProgram(model)
p.EnableAltScreen()
p.EnableMouseAllMotion()

// Strongly discouraged as these commands could be sent before starting the renderer, resulting
// in rendering artifacts. This is due to the fact that commands run asynchronously in a goroutine.
func (m model) Init() tea.Cmd {
    return tea.Batch(tea.EnterAltScreen, tea.EnableMouseAllMotion)
}

Also included are two subtle—yet important—rendering improvements.

Changelog

New

  • Added ProgramOption WithAltScreen for starting programs in the alternate screen buffer.
  • Added ProgramOptions WithMouseCellMotion and WithMouseAllMotion for starting programs with the mouse enabled.

Fixed

  • Programs will no longer render artifacts when exiting due to an error or panic.
  • If a view returns the empty string output will be cleared. Previously, rendering would be skipped entirely.

Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or right here in GitHub Discussions.

The Charm logo

v0.13.4

15 May 00:16
Compare
Choose a tag to compare

Rendering Hotfix

This bugfix release corrects a mis-rendering that could occur when the number of lines increases.

✌️ Special thanks for @fiws for reporting this one.


Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or right here in GitHub Discussions.

The Charm logo

v0.13.3

10 May 16:53
Compare
Choose a tag to compare

Faster Rendering

This release introduces a performance optimization to the Bubble Tea standard renderer where only lines that have changed since the last render will be drawn.

Note that there's already an optimization in place that will skip rendering entirely if nothing has changed.


Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or right here in GitHub Discussions.

The Charm logo

v0.13.2

08 Apr 14:26
Compare
Choose a tag to compare

This bugfix release ensures Bubble Tea clears the bottom line before exiting, preventing the cursor the last row of output from potentially appearing behind the prompt. It also fixes a data race in the default renderer and improves compatibility with rxvt-based terminals.


Thoughts? Questions? Feel free to reach out on Twitter and The Fediverse.

The Charm logo

v0.13.1

13 Mar 03:36
Compare
Choose a tag to compare

This bugfix release prevents a data race in the default renderer.


Thoughts? Questions? Feel free to reach out on Twitter and The Fediverse.

The Charm logo

v0.13.0

11 Mar 22:11
c310475
Compare
Choose a tag to compare

This release adds two new features as well as a few other small-ish improvements.

New: Headless Mode

WithoutRenderer is a new program option that, when set, will tell Bubble Tea not to manage rendering. With the renderer disabled print and log statements will, by default, go straight to standard output. This opens up a few possibilities:

  • Daemon Mode: It's now possible for your Bubble Tea program to also operate as a daemon in addition to a TUI. See the daemon-tui-combo example for an example implementation.
  • Non-TTY Mode: If output’s not a TTY your Bubble Tea program can simply print or log output to stdout. See the daemon-tui-combo example for an example implementation.
  • General Purpose Application Development: It's possible to use the Bubble Tea framework for general purpose application development. That is to say, your can take advantage of this implementation of The Elm Architecture to build other types of applications, like servers, GUIs and so on.

Bubble Tea demo of an application switching between TUI and daemon modes

New: Toggle the Alt Screen

Previously, you had to choose whether your application would be inline or fullscreen prior to starting your Bubble Tea program. Now you can jump in and out of the altscreen with the new EnterAltScreen and ExitAltScreen commands.

Bubble Tea demo of an application switching between inline and altscreen modes

Changelog

New

  • Added option WithoutRenderer for disabling the Bubble Tea renderer in non-TTY, daemon and general-purpose application development contexts (details)
  • New EnterAltScreen and ExitAltScreen commands for jumping into and out of the alternate screen buffer (read: full window mode)
  • Bubble Tea will not automatically exit the alternate screen buffer on quit

Changed

Fixed

  • All key constants (such as KeyEnter) are now of type [KeyType]

Thoughts? Questions? Feel free to reach out on Twitter and The Fediverse.

The Charm logo

v0.12.5

01 Mar 18:26
Compare
Choose a tag to compare

This big news in this release is that Bubble Tea will now automatically open a TTY for input (or a ConPTY on Windows) if input is not a terminal. In other words, if you pipe something into Bubble Tea, the keyboard and mouse will just work. Note that if you’re already specifying a custom input via tea.WithInput the Bubble Tea runtime will assume you have things under control and won't open a TTY/ConPTY.

Example of Bubble Tea working with piped input

New

  • If input is not a TTY, automatically open a TTY unless the user has explicitly specified a custom input

Fixed

  • Bubble Tea projects now build properly in Go 1.16. Previously building Bubble Tea on Go 1.16 meant running go mod tidy.

Thoughts? Questions? Feel free to reach out on Twitter and The Fediverse.

The Charm logo

v0.12.4

18 Jan 17:25
Compare
Choose a tag to compare

This mini-release adds the tea.Sequentially helper command, which is useful for executing several commands in order. For example, maybe you want to save and quit, but only if the save was successful:

func saveStateCmd() Msg {
	if err := save(); err != nil {
 		return errMsg{err}
 	}
	return nil
}

cmd := Sequentially(saveStateCmd, Quit)

For details, see the docs.


Thoughts? Questions? Feel free to reach out on Twitter and The Fediverse.

The Charm logo

v0.12.3

15 Jan 18:03
e9efdf8
Compare
Choose a tag to compare

This release contains some small but powerful improvements to make Bubble Tea more flexible and more foolproof.

Improved Rendering

Lines wider than the window width are now automatically trimmed to prevent line wrapping which previously messed up rendering a little. Note that this is for unix systems only: Windows is not able to determine terminal width, so Bubble Tea wouldn't know where to truncate lines.

Do note that for more precise control you can also truncate long lines yourself. We recommend the truncate package in @muesli’s excellent Reflow project which Bubble Tea is using internally to trim lines.

Custom Input and Output

Input and output can now be set to any valid io.Reader and io.Writer (by default they're os.Stdin and os.Stdout, respectively). Additionally, if input’s not a TTY the runtime will simply stop listening for input (previously, Bubble Tea would exit with error).

SIGINT

Bubble Tea now exits gracefully when it receives a SIGINT. In most casts ctrl-c still won’t send an interrupt because those keys are sent through to Bubble Tea so you can map them as you'd like. If input’s not a TTY, however, ctrl-c will generally send an in interrupt and Bubble Tea will restore the terminal and quit.


Thoughts? Questions? Feel free to reach out on Twitter and The Fediverse.

v0.12.2

02 Nov 15:07
Compare
Choose a tag to compare

This release adds support for multi-character input, most notably Chinese and Japanese IME. Adding this support required some API changes:

  • Key.Rune is now Key.Runes
  • Type KeyRune is now KeyRunes
  • Key.IsRune() was removed. To determine if input is a string (or []rune) use Key.Type == KeyRunes