Releases: charmbracelet/bubbles
v0.18.0
Textarea, but faster
This release features several fixes and big performance improvements for the textarea
bubble.
What's Changed
New
- Optional File Permissions and File Size by @maaslalani in #471
- Add Paginator OnFirstPage method by @maaslalani in #463
Improved
- Implement Memoization to Speed Up Textarea Rendering by @wesen in #427
- refactor(textinput): reduce allocations by @naglis in #413
- Use
uniseg.StringWidth
by @maaslalani in #462
Fixed
- fix(textarea): correctly trim incoming paste by @muesli in #469
- fix(textinput): Placeholder No Longer Changes Width + Paste Calculation by @hopefulTex in #451
- fix(viewport): pad width to contentWidth by @ivanvc in #388
New Contributors
- @seanbanko made their first contribution in #442
- @hopefulTex made their first contribution in #451
- @ivanvc made their first contribution in #388
- @wesen made their first contribution in #427
Full Changelog: v0.17.1...v0.18.0
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.
v0.17.1
What's Changed
- feat: upgrade bubbletea and remove deprecated code by @aymanbagabas in #448
Full Changelog: v0.17.0...v0.17.1
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.
v0.17.0
Text input autocompletions and various improvements
Autocompletion in Text Input
So @toadle wanted textinput
s to support autocompletion in a ghost-text kind of a way. Rather than wait for us to do it he did what any dedicated open source developer would: he sent a PR! And now we can all benefit from his hard work.
Autocompletion is super easy to use:
ti := textinput.New()
ti.SetSuggestions([]string{"meow", "purr"})
By default you can press ctrl+n and ctrl+p to cycle through suggestions, but those keybindings can be changed as you, the application developer, see fit. For details check out textinput.SetSuggestions
and the corresponding KeyMap
in the docs.
Is the progress bar done yet?
@yrashk acutely noticed that to nicely transition from one state to another after an animated progress bar fills up it's helpful to know when the animated has finished animating before transitioning. To solve for this he added an IsAnimating
method to the progress
model. Thanks, @yrashk!
Changelog
New!
- Support suggestions and autocompletion in textinput by @toadle in #407
- Add method for determining if progress bar is animating by @yrashk in #386
Improved
- Update fuzzy library by @caarlos0 in #379
- Reduce allocations in
filterItems
by @naglis in #396 - Improve message when list is empty by @maaslalani in #393
Fixed
Full Changelog: v0.16.1...v0.17.0
New Contributors
- @yrashk made their first contribution in #386
- @naglis made their first contribution in #391
- @lc-1010 made their first contribution in #421
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.
v0.16.1
File Picker Bubble π π«§
This release introduces a brand new filepicker
bubble, new features, and a tonne of bugfixes.
Let us know what you think, ask questions, or just say hello in our Discord.
For a quick start on how to use this bubble, take a look at the Example code.
Getting Started
Create a new file picker and add it to your Bubble Tea model.
picker := filepicker.New()
picker.CurrentDirectory, err = os.UserHomeDir()
if err != nil {
// ...
}
m := model{
picker: picker,
// ...
}
Initialize the file picker in your Model
's Init
function.
func (m model) Init() tea.Cmd {
return tea.Batch(
m.picker.Init(),
// ...
)
}
Update the filepicker as any other bubble in the Update
function.
After the picker.Update
, use the DidSelectFile(msg tea.Msg)
function to perform an action when the user selects a valid file.
You may allow only certain file types to be selected with the AllowedTypes
property and allow directories to be selected with the DirAllowed
property. To see the currently selected file/directory use the Path
property.
var cmd tea.Cmd
m.picker, cmd = m.picker.Update(msg)
// Did the user select a file?
if didSelect, path := m.picker.DidSelectFile(msg); didSelect {
// Get the path of the selected file.
return m, tea.Println("You selected: " + selectedPath)
}
return m, cmd
For the full example on how to use this bubble, take a look at the Example code.
New
- Filepicker: new bubble by @maaslalani in #343
- Textarea: max width/height configurable by @knz in #370
- Spinner: periods of ellipsis by @meowgorithm in #375
- List: infinite scrolling by @jon4hz in #316
Fixed
- app would crash if
deleteWordRight
was called at the end of line by @infastin in #313 - support pastes that end with a newline character by @knz in #314
- data corruption after multi-line input by @knz in #318
- Remove unused
BackgroundStyle
in TextInput by @savannahostrowski in #341 - add bounds checking to the
SelectedRow
by @MikaelFangel in #351 - fix(progress): last gradient color off by one by @residualmind in #338
- deprecate
CursorStyle
in favour ofCursor.Style
by @maaslalani in #365 - Reset blink only when
CursorBlink
by @remiposo in #378
New Contributors
- @infastin made their first contribution in #313
- @gzipChrist made their first contribution in #332
- @savannahostrowski made their first contribution in #341
- @MikaelFangel made their first contribution in #351
- @stefanbildl made their first contribution in #339
- @residualmind made their first contribution in #338
- @bashbunni made their first contribution in #359
- @squrki made their first contribution in #373
- @remiposo made their first contribution in #378
Full Changelog: v0.15.0...v0.16.0
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.
v0.15.0
Ceci, Cela
This is primarily a housekeeping release with lots and lots of bugfixes and improvements from the community. Thanks, everyone, for all your support! π€
Please do feel free to say hello, ask questions, and tell us what else you want to see in our Discord. π¬
New
textinput + textarea
: support for forthcoming bracketed paste (see also charmbracelet/bubbletea#397) and avoid ctrl chars in clipboard input by @knz in #214textinput
: support key bindings textarea by @knz in #270paginator
: make paginator keybindings customizable by @knz in #272viewport
: ExposeTotalLineCount()
andVisibleLineCount()
methods within viewport by @adaam2 in #283table
: makeUpdateViewport()
have constant runtime by @pja237 in #284table
: addSetColumns
method to set columns by @maaslalani in #260table
: expose rows by @marcantoineg in #287
Fixed
textarea
: fix paste by @hhe07 in #250viewport
: fix performance scrolling by @meowgorithm in #312help
: full help renders fully when width is unset by @craiggwilson in #218cursor
: applyTextStyle
inline by @knz in #230cursor
: delegate cursor logic to cursor bubble by @maaslalani in #181cursor
: fixSetValue
cursor movement by @maaslalani in #267general
: miscellaneous housekeeping by @twpayne in #243
New Contributors
- @twpayne made their first contribution in #243
- @dependabot made their first contribution in #252
- @hhe07 made their first contribution in #250
- @craiggwilson made their first contribution in #218
- @adaam2 made their first contribution in #283
- @pja237 made their first contribution in #284
- @marcantoineg made their first contribution in #287
- @yusufmalikul made their first contribution in #300
Full Changelog: v0.14.0...v0.15.0
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.
v0.14.0
Table Bubble
This feature release of Bubbles includes a brand new table
bubble that you can use to show and select tabular data! Huge thanks to @wesleimp for contributing this change β€οΈ.
See the example code for an example of how to use the table
in your Bubble Tea applications.
Getting Started
Create a new table
:
t := table.New(
table.WithColumns(columns),
table.WithRows(rows),
table.WithFocused(true),
table.WithHeight(7),
)
Alternatively,
t := table.New(table.WithColumns(columns))
t.SetRows(rows)
t.Focus()
t.SetHeight(7)
Style the table
how you want:
s := table.DefaultStyles()
s.Header = s.Header.
BorderStyle(lipgloss.NormalBorder()).
BorderForeground(lipgloss.Color("240")).
BorderBottom(true).
Bold(false)
s.Selected = s.Selected.
Foreground(lipgloss.Color("229")).
Background(lipgloss.Color("57")).
Bold(false)
t.SetStyles(s)
And then Update
and Render (View
) the table:
type model struct {
table table.Model
}
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
var cmd tea.Cmd
m.table, cmd = m.table.Update(msg)
return m, cmd
}
func (m model) View() string {
return m.table.View()
}
Other Changes
- Ctrl+H backspaces text by @maaslalani in #199
LineCount()
+ Include New Line characters inLength()
by @maaslalani in #204- fix(viewport): honor width and height settings by @meowgorithm in #216
- feat(textarea): new bindings for "go to begin" / "go to end" by @knz in #226
- feat(textarea):
PromptFunc
, support dynamic prompts by @knz in #211 - fix(viewport): properly truncate to size by @knz in #228
New Contributors
- @knz made their first contribution in #208
- @buztard made their first contribution in #220
- @nikaro made their first contribution in #219
Full Changelog: v0.13.0...v0.14.0
Read more about it in our examples and docs:
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Slack.
v0.13.0
Textarea Bubble
This feature release includes a brand new textarea
bubble that you can use to input as many lines of text as your heart desires (or until your computer memory runs out, whichever comes first).
See the example code for a simple example of how to use the textarea
in your Bubble Tea applications.
Customization
There are a few ways to customize the text area.
SetHeight(height int)
: tells the component how many lines of text it should display at once.SetWidth(width int)
: tells the component how wide the it should be.ShowLineNumbers
: whether or not to show line numbers on the left-hand side of a line of text.Prompt
: the prompt to display on the left-hand side.EndOfBufferCharacter
: the character to display as the line number after the last line to fill the rest of the height. Defaults to~
.CharLimit
: Prevents users from typing more than a set number of characters.KeyMap
: The set of keybindings to navigate and interact with thetextarea
.
Styling
The textarea
can be customized heavily with Lip Gloss.
FocusedStyles
: the styles to be applied while thetextarea
is focused.BlurredStyles
: the styles to be applied while thetextarea
is focused.
Each of the above properties has the below sub-properties that can be modified.
Base lipgloss.Style
CursorLine lipgloss.Style
CursorLineNumber lipgloss.Style
EndOfBuffer lipgloss.Style
LineNumber lipgloss.Style
Placeholder lipgloss.Style
Prompt lipgloss.Style
Text lipgloss.Style
See the split editors example for how to style the textarea
component.
Read more about it in our examples and docs:
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Slack.
v0.12.0
Validate Your Darlings
This release of Bubbles allows you to handle input validation by defining validation functions that ensure the user is typing text that you expect.
The Validate
API introduces a function that is called every time the input changes to ensure that it is still valid input.
// ValidateFunc is a function that returns an error if the input is invalid.
type ValidateFunc func(string) error
// Validate is a function that checks whether or not the text within the
// input is valid. If it is not valid, the `Err` field will be set to the
// error returned by the function. If the function is not defined, all
// input is considered valid.
Validate ValidateFunc
View the Example Code to see Validate
and ValidateFunc
s work in code.
With these awesome changes introduced by @IllusionMan1212, we can now build forms that ensure all input is valid like a credit card input form!
See the full example to handle input validation in your Bubble Tea apps.
Custom List Status Bar Item Names
Thanks to @wesleimp, lists now have a new function to allow you to set a custom status bar item name. Simply call SetStatusBarItemName
on your list with the singular and plural name of your list item and Bubbles will handle the rest (defaults to "item", "items").
list.SetStatusBarItemName("grocery", "groceries")
This will change the string displayed underneath the Title
of the list, in this case the item name is being used for displaying 2 groceries
.
New Spinners π«
This release contains two brand new spinners introduced by @wesleimp, check them out:
What's Changed
- Validate Input by @maaslalani in #167
- Custom status bar title by @wesleimp in #169
- New spinners by @wesleimp in #172
New Contributors
- @motemen made their first contribution in #168
- @maaslalani made their first contribution in #167
- @wesleimp made their first contribution in #169
- @vzvu3k6k made their first contribution in #171
- @charlieroth made their first contribution in #177
Full Changelog: v0.11.0...v0.12.0
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or Slack.
v0.11.0
Housekeeping
π§Ή Hot on the heels of Bubble Tea v0.21.0, this is a maintenance release with a lot of great quality-of-life features from both the Charm team and the community. Enjoy!
Changelog
New
- list: allow custom filter functions by @caarlos0 in #103
- list: allow to set the height of the item by @caarlos0 in #155
- viewport: add missing keymap help by @aymanbagabas in #146
- textinput: add blink method to textinput to return blink state by @aschey in #122
- progress: set a custom termenv color profile by @aymanbagabas in #152
Fixed
- list: fix padding in titlebar when nothing is displayed by @toadle in #139
- textinput: support KeySpace in present and future Bubble Tea versions by @meowgorithm in #161
Changed
- spinner: remove provisional spinner lifetime stuff by @meowgorithm in #112
- list: fix rendering of an empty list by @aymanbagabas in #123
- progress: Percent() now returns progress as presented visually by @meowgorithm in #132
New Contributors
Full Changelog: v0.10.3...v0.11.0
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Slack.
v0.10.3
A Couple βo List Bugfixes
This small patch release fixes a couple small bugs with regard to the quit keybinding in list
. Cheers! π»
Fixed
- Properly set quit keybinding in keybinding update phase #108
- Disable quit keybinding while filtering (thanks @lorenries!) #118
New Contributors
- @aymanbagabas made their first contribution in #108
- @mirkoperillo made their first contribution in #115
- @treilik made their first contribution in #113
- @lorenries made their first contribution in #118
Full Changelog: v0.10.2...v0.10.3
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Slack.