Releases: charmbracelet/bubbles
v0.10.2
Housekeeping
🧹 This is a small release to improve the overall integrity of the viewport
and textinput
Bubbles.
- Setting the width and height on a
viewport
’s style attribute is now a no-op. Previously it would produce some pretty confusing rendering and generally conflict with theWidth
andHeight
attributes on the model. - Fix a
textinput
regression where deleting words left of the cursor didn't actually do anything (courtesy @IllusionMan1212)
Full Changelog: v0.10.1...v0.10.2
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Slack.
v0.10.1
Viewport Hotfixes
This release fixes some viewport
bugs introduced in v0.10.0
:
- Fixed a bug where the
viewport
's y-offset could be negative - Fixed an off-by-one error in
GotoBottom()
🤗 Special thanks to @knipferrc and @IllusionMan1212 for their assistance with the bugfixes.
Also
- Bumped atotto/clipboard to v0.1.4 for clipboard-related WSL and plan9 support
- Bumped Lip Gloss to
v0.4.0
Full Changelog: v0.10.0...v0.10.1
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Slack.
v0.10.0
Timer, stopwatch, bugfixes and quality-of-life improvements
🎊 Happy New Year! This is a big release with a couple new components, a bunch of bug fixes, and some general quality-of-life improvements across the board.
tl;dr
New
- Add
timer
component (thanks @caarlos0) #67 - Add
stopwatch
component (thanks @caarlos0) #68 viewport
can now be initialized with aNew()
constructor at the package level #92viewport
now has customizable keybindings via thekey
package #92viewport
mouse wheel speed can be customized #92- The mouse's scroll wheel can now be disabled for a
viewport
#92
Changed
NewModel()
constructors are now deprecated in favor ofNew()
#93- Expose
list.FilterMachesMsg
(thanks @jon4hz) #77 - Expand
key.Matches
to accept multiple binding arguments #84 spinner
now ignores messages sent by other spinners #91
Fixed
- Update keybindings when calling
SetItems
on alist
(thanks @paralin) #90 - Update keybindings after calling
InsertItem
on alist
#94 - Fix
textinput
infinite loop and panic (thanks @IllusionMan1212) #89 - Fix bug where
viewport
wasn't rendering final lines #74 - Fix bug where
viewport
performance rendering could render one line too many #74
Hungry for more? Here are the details.
New: Timer
@caarlos0 added a simple timer Bubble for counting down.
See the example code and docs for details.
New: Stopwatch
To match the timer, @caarlos0 also added a simple stopwatch Bubble for counting up.
See the example code and docs for details.
Constructor Changes
Prior to this update the convention was to create new models via a NewModel
. We've changed that convention to New()
for brevity and readability. NewModel()
will continue to work in a deprecated fashion to ease the update process.
// Old
s := spinner.NewModel()
// New!
s := spinner.New()
Viewport Improvements
As of this update you're strongly encouraged to initialize viewport models with the new New(width, height int) Model
function, however it's currently optional to reduce friction when upgrading.
const width, height = 40, 80
vp := viewport.New(width, height)
Viewport models also now have a Style lipgloss.Style
property you can use to apply borders, margins, and padding directly to a viewport. Not more magic numbers, random constants, and fussy arithmetic.
vp.Style = lipgloss.NewStyle().
BorderStyle(lipgloss.RoundedBorder()).
BorderForeground(lipgloss.Color("62")).
PaddingRight(2)
Keybindings on a viewport are now defined via the key
Bubble and can now be easily remapped.
vp.KeyMap.Up = key.NewBinding(WithKeys("up", "w"))
For details see the available bindings. Note that you can also just match on keys in the parent Update
and call viewport methods like LineUp programmatically.
And, lastly, you can now change the mouse wheel scroll speed, or disable it entirely:
vp := viewport.New()
vp.MouseWheelDelta = 5 // make mouse scrolling really fast!
vp.MouseWheelEnabled = false // jk, turn it off
See the viewport docs for details.
Spinner Improvements
Now spinners only respond to their own spin messages so you don't need any more fancy logic when you want to control multiple spinners at once. To start a specific spinner you now call Tick()
on the model instead of the package:
s := spinner.New()
// Old
cmd := spinner.Tick()
// New
cmd := s.Tick()
For posterity, you can still use the package-level Tick
method in a deprecated fashion, however note that it will affect all spinners that process the resulting TickMsg
as it did prior to the release.
For details see the spinner docs.
Keybindings
key.Binding
currently allows you to bind against multiple keys:
binding := key.Binding(key.WithKeys("q", "ctrl+c"))
However, sometimes you may also want to match on multiple bindings:
left := key.Binding(key.WithKeys("h", "left"))
right := key.Binding(key.WithKeys("l", "right"))
case key.Matches(msg, left), key.Matches(msg, right):
This update expands key.Matches
to accept multiple arguments so you can condense the above case
statement to:
case key.Matches(msg, left, right):
For more on how keybindings work see the key docs.
New Contributors
- @caarlos0 made their first contribution #67
- @anirvan made their first contribution #81
- @paralin made their first contribution #90
- @IllusionMan1212 made their first contribution #89
- @jon4hz made their first contribution #77
Full Changelog: v0.9.0...v0.10.0
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Slack.
v0.9.0
Lists, Animated Progress Bar and More
There are a handful of new things in this release, the biggest being the brand new List Bubble we extrapolated from Glow. Read on!
New: List
The List Bubble is a highly customizable, batteries-included component for browsing a set of items. It features pagination, fuzzy filtering, auto-generated help, an activity spinner, and status messages, all of which can be enabled and disabled as needed.
New: Key
A non-visual component for managing keybindings. It’s useful for allowing users to remap keybindings, allows keys to be enabled and disabled programatically, and can be used to generate help views.
import "github.com/charmbracelet/bubbles/key"
up := key.NewBinding(
key.WithKeys("up", "k"),
key.WithHelp("↑/k", "move up"),
)
if key.Matches(msg, up) {
// ...
}
New: Help
A customizable horizontal mini help view that automatically generates itself from your keybindings. It features single and multi-line modes, which the user can optionally toggle between. It will truncate gracefully if the terminal is too wide for the content.
Updated: Progress Bar
The progress bar has been updated so that it can now animate itself via Harmonica. You can, of course, still render non-animated progress bars too.
Note that there are also some minor API changes to the Progress Bubble. See the changelog below.
Progress Bar Changelog
Changed
NewModel
no longer returns an errorModel.View(float64) string
is nowModel.View() string
(to render a static view per the prior version useModel.ViewAs(float64) string
)- Invalid hex colors now render as black
New
- Added
WithSpringOptions
to customize spring animation - Added
Model.Update
for animating the progress bar - Added
Model.ViewAs(float64) string
for rendering static progress bars Model
now satisfies thetea.Model
interface making more composable
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter or The Fediverse.
v0.8.0
Textinput Cursor Options and Enhancements
This release introduces options for textinput cursor behavior and improves subtleties with cursor blinking when multiple textinputs are present.
To change the cursor behavior:
import "github.com/charmbracelet/bubbles/textinput"
m := textinput.NewModel()
m.SetCursorMode(textinput.CursorStatic) // no blinking
m.SetCursorMode(textinput.CursorHide) // actually, let's hide the cursor
m.SetCursorMode(textinput.CursorBlink) // jk let's make it blink
Changelog
New
- Cursors now have three modes:
CursorBlink
,CursorStatic
andCursorHide
(all of typeCursorMode
). You can set the cursor mode viatextinput
’sModel.SetCursor(CursorMode)
and get the cursor mode withModel.CursorMode() CursorMode
.
Changed
textinput
’sModel.Focus()
is nowModel.Focus() tea.Cmd
. This will initiate a properly timed cursor blink when focusing on a textinput if the cursor mode is set to blink.
Fixed
- After their initial cursor blink (initiated by
textinput.Blink() tea.Cmd
), textinputs can now only receive blink messages they sent. This prevents textinputs from receiving other textinputs blink messages when focus changes. - When cursor blink messages are sent, former blink messages in transit are invalidated, eliminating the change of rogue blinks.
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter and The Fediverse, or right here in GitHub Discussions.
v0.7.9
Minor Textinput Updates
This is a minor PR that improves the textinput API and behavior when dealing with masked input, such as passwords.
Changed
SetCursor(int)
,CursorStart()
andCursorEnd()
no longer return values.- If
EchoMode
is notEchoNormal
word-to-word movement instead jumps to the beginning and end. Word-based deletion also deletes to the beginning and end.
New
Cursor() int
returns the cursor position.
Removed
- Removed
Cursor string
, which did absolutely nothing.
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter and The Fediverse, or right here in GitHub Discussions.
v0.7.8
The mini-release prevents a panic that could occur when setting content in the viewport.
Thoughts? Questions? Feel free to reach out on Twitter and The Fediverse. We love hearing from you.
v0.7.7
Hello, Lip Gloss
This release introduces Lip Gloss into the Spinner and Text Input components offering a greater range of styling options. Note that this introduces some minor API changes.
New
Text Input
- Added
textinput.Model.PromptStyle
. Previously, styling the prompt was left as an exercise for the user.
Changed
Spinner
Model.ForegroundColor
andModel.BackgroundColor
is now simplyModel.Style
, alipgloss.Style
.
Text Input
Model.TextColor
is nowModel.TextStyle
Model.PlaceholderColor
is nowModel.PlaceholderStyle
Model.CursorColor
is nowModel.CursorStyle
All of these types are now lipgloss.Style
.
Improved
- Better rxvt-based terminal compatibility (courtesy Termenv)
- Bumped
bubbletea
,termenv
,reflow
,go-runewidth
andgo-colorful
dependencies
Fixed
- Data race in data race rxvt-based terminals (courtesy Termenv)
- Reset cursor in
SetValue
when initial position is0
(thanks, @kiyonlin)
Thoughts? Questions? Feel free to reach out on Twitter and The Fediverse. We love hearing from you.
v0.7.6
Progress!
This release features a simple, flexible, and customizable progress bar for your terminal apps.
- Choose from solid and gradient fills
- Set the empty and filled runes to whatever you'd like
- The percentage readout is customizable and can also be omitted entirely
For more info see:
v0.7.5
This release contains design updates to Spinner which provide spin-speeds on a per-spinner basis for a better out-of-the-box experience, as well as a bugfix.
New:
- Added default spinners:
spinner.MiniDot
,spinner.Pulse
,spinner.Points
Changed:
- Type
spinner.Spinner
is now astruct
with properiesFrames []string
andFPS time.Duration
- Visual improvements to
spinner.Monkey
,spinner.Globe
, andspinner.Moon
Removed:
spinner.Bit8
Fixed:
spinner.TickMsg
is now sent on both start and update; the previous version had an internal un-exported start message which made passing messages to spinners more cumbersome