At last: tabs that render the way you want ’em to. With the new Style.TabWidth() method, you can determine exactly how a \t will render.
Before this release, Lip Gloss used to mis-measure a tab (i.e. a \t) at 0 cells wide when they actually render at different widths in different terminals (usually 8 cells, sometimes 4 cells). For these reasons, tabs are almost never what you want when designing layouts for TUIs.
With this release, a tab will get converted to 4 spaces by default—so this is a behavioral change—but you can customize the behavior as well as disable it entirely.
s := lipgloss.NewStyle() // 4 spaces per tab, the default
s = s.TabWidth(2) // 2 spaces per tab
s = s.TabWidth(0) // remove tabs
s = s.TabWidth(-1) // don't convert tabs to spaces
s = s.TabWidth(NoTabConversion) // alias of the above
You can disable the feature with Style.TabWidth(NoTabConversion) (or Style.TabWidth(-1), if you're the pedantic type).
Bug Fixes
This release also includes a bunch of bug fixes. This includes:
You can trigger a rebase of this PR by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Note
Automatic rebases have been disabled on this pull request as it has been open for over 30 days.
Bumps github.com/charmbracelet/lipgloss from 0.7.1 to 0.8.0.
Release notes
Sourced from github.com/charmbracelet/lipgloss's releases.
Commits
07d2272
chore(ci): bump workflow actions7611cdf
chore(deps): bump golang.org/x/crypto in /examples (#192)160ffe8
fix: cache color profile and background (#212)ac8231e
fix: renderer race condition (#210)b3bce23
chore(docs): add section about tab conversion (#207)0124803
chore(lint): add various nolint directives (#206)df8b3fa
feat: convert tabs to spaces withStyle.TabWidth(int)
(#204)233079e
fix: go mod tidy examples3556cdf
feat(deps): update termenv (#202)859b49e
docs: add FAQ (#189)You can trigger a rebase of this PR by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show