Skip to content

v0.21.0

Latest
Compare
Choose a tag to compare
@github-actions github-actions released this 09 Apr 18:44
· 12 commits to master since this release
8b55efb

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 edge

To 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

Bug fixes

Dependency updates

Documentation updates

Other work


The Charm logo

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

  1. It is disabled by default in v1, but will be enabled in v2.