v0.21.0
Viewport improvements
Finally, viewport finally has horizontal scrolling ✨!1
To enable it, use SetHorizontalStep (default in v2 will be 6).
You can also scroll manually with ScrollLeft and ScrollRight, and use
SetXOffset to scroll to a specific position (or 0 to reset):
vp := viewport.New()
vp.SetHorizontalStep(10) // how many columns to scroll on each key press
vp.ScrollRight(30) // pan 30 columns to the right!
vp.ScrollLeft(10) // pan 10 columns to the left!
vp.SetXOffset(0) // back to the left edgeTo make the API more consistent, vertical scroll functions were also renamed,
and the old ones were deprecated (and will be removed in v2):
// Scroll n lines up/down:
func (m Model) LineUp(int) // deprecated
func (m Model) ScrollUp(int) // new!
func (m Model) LineDown(int) // deprecated
func (m Model) ScrollDown(int) // new!
// Scroll half page up/down:
func (m Model) HalfViewUp() []string // deprecated
func (m Model) HalfPageUp() []string // new!
func (m Model) HalfViewDown() []string // deprecated
func (m Model) HalfPageDown() []string // new!
// Scroll a full page up/down:
func (m Model) ViewUp(int) []string // deprecated
func (m Model) PageUp(int) []string // new!
func (m Model) ViewDown(int) []string // deprecated
func (m Model) PageDown(int) []string // new!Note
In v2, these functions will not return lines []string anymore, as it is no
longer needed due to HighPerformanceRendering being deprecated as well.
Other improvements
The list bubble got a couple of new functions: SetFilterText,
SetFilterState, and GlobalIndex - which you can use to get the index of the
item in the unfiltered, original item list.
On textinput, you can now get the matched suggestions and more with
MatchedSuggestions and CurrentSuggestionIndex.
To put the cherry on top, this release also includes numerous bug fixes.
You can read about each of them in the linked commits/PRs below.
Changelog
New Features
- d019ed3: feat(list): add SetFilterText and SetFilterState (#335) (@taigrr)
- 171a9d6: feat(list): implement GlobalIndex helper (#574) (@nobe4)
- 4382fdf: feat(textinput): expose matched suggestions and index (@luevano)
- 2d53a61: feat(viewport): horizontal scroll (#240) (@tty2)
- ea344ab: feat(viewport): horizontal scroll with mouse wheel (#761) (@UnseenBook)
Bug fixes
- f2434c3: Revert "fix(viewport): normalize method names" (@caarlos0)
- 8101a34: fix(ci): add lint and lint-sync workflows and update golangci.yml (#651) (@aymanbagabas)
- 54f28b6: fix(filepicker): properly scrolling filepicker (#753) (@caarlos0)
- 81d444a: fix(help): wrong full help sep rendering (@luevano)
- f439d83: fix(textarea): max height should not determine max lines (@meowgorithm)
- 8b55efb: fix(textarea): placeholder with chinese chars (#767) (@caarlos0)
- 8624776: fix(textinput): slicing outside cap (#532) (@MikaelFangel)
- c7f889e: fix(viewport): normalize method names (@caarlos0)
- 39668ec: fix(viewport): normalize method names (#763) (@caarlos0)
- 7ab08fb: fix(viewport): scroll to last line when borders (#706) (@caarlos0)
- 730f5a2: fix: debounce stopwatch and timer (@meowgorithm)
- bd2a5b0: fix: golangci-lint 2 fixes (#769) (@caarlos0)
- 9589cbc: fix: lint issues and disable predeclared linter (#614) (@aymanbagabas)
- 398e92c: fix: remove default character limit (@meowgorithm)
- 1bdd4c6: fix: stopwatch.Start() (#707) (@bevicted)
- 9a262e9: fix: use atomic for ids (#634) (@caarlos0)
Dependency updates
- 1797ac2: feat(deps): bump github.com/charmbracelet/bubbletea from 1.1.0 to 1.1.1 (#611) (@dependabot[bot])
- a9b780a: feat(deps): bump github.com/charmbracelet/lipgloss from 0.13.0 to 0.13.1 (@dependabot[bot])
- db3514c: feat(deps): bump github.com/charmbracelet/lipgloss from 0.13.1 to 1.0.0 (#655) (@dependabot[bot])
- 43aa82c: feat(deps): bump github.com/charmbracelet/x/ansi (#716) (@dependabot[bot])
- c1199d7: feat(deps): bump github.com/charmbracelet/x/ansi from 0.2.3 to 0.3.0 (#613) (@dependabot[bot])
- d3ac47d: feat(deps): bump github.com/charmbracelet/x/ansi from 0.3.0 to 0.3.1 (#615) (@dependabot[bot])
- ed14316: feat(deps): bump github.com/charmbracelet/x/ansi from 0.3.1 to 0.3.2 (#618) (@dependabot[bot])
Documentation updates
- cf3f46a: docs(list): fix grammar in doc comment and README (#627) (@oahshtsua)
- 9e5365e: docs: add example for ValidateFunc (#705) (@bashbunni)
- 87a4e45: docs: additional bubbles (#583) (@caarlos0)
- e3ce11a: docs: update charm & friends blurb (#703) (@bashbunni)
- 178590b: docs: update contributing guidelines (#640) (@bashbunni)
Other work
- 0f9e38c: Don't render suggestions when textinput is not focused. (@elProxy)
- e5296a2: ci: fix goreleaser config (#668) (@caarlos0)
- 76433f7: ci: fix linting on windows (@andreynering)
- d91c9aa: ci: rm .golangci-soft.yml (@caarlos0)
- 2f49443: ci: sync dependabot config (#734) (@charmcli)
- 7a6b190: ci: sync dependabot config (#736) (@charmcli)
- d58217b: ci: sync golangci-lint config (#750) (@github-actions[bot])
- cce8481: ci: sync golangci-lint config (#770) (@github-actions[bot])
- 0305695: ci: test on oldstable and stable go versions, automerge dependabot (#755) (@caarlos0)
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.
-
It is disabled by default in v1, but will be enabled in v2. ↩
