Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tree): support width and indenter styling #446

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dlvhdr
Copy link

@dlvhdr dlvhdr commented Nov 23, 2024

Some of the stuff I've been implementing on charmbracelet/bubbles#639 should go into lipgloss. This would help simplify the bubble code and is better for separating the rendering logic into lipgloss itself.

This PR adds two things:

  1. The ability to style the indenter with both a static style and a function style
  2. The ability to specify the tree's width, which allows tree nodes to stretch to fill it.

I've also wrote a new example to show what this enables.

TODO: check this against my tree bubble

Warning

This does introduce a "breaking change", not in the API but:
Trees that have subtrees with their own renderers, meaning they set a custom item/enumerator style, will need to now also set an indenter style, if they want to keep a consistent indentation styling.
If they don't set one the default empty style is used and it can look weird to suddenly have 2 kinds of indentation stylings.
Previously this was solved by using the enumerator style.

image image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant