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

Force-wrap long Strings #44

Merged
merged 1 commit into from Sep 3, 2021
Merged

Force-wrap long Strings #44

merged 1 commit into from Sep 3, 2021

Conversation

meowgorithm
Copy link
Member

This update forces strings that run wider than the given width to wrap as a sensible default.

So, given the following code:

s := lipgloss.NewStyle().
    BorderStyle(lipgloss.RoundedBorder()).
    Width(5).
    Render("Schnurrbart")

fmt.Println(s)

Prior to this update it would render as such:

╭─────╮
│Schnurrbart│
╰─────╯

After this update is renders as follows:

╭─────╮
│Schnu│
│rrbar│
│t    │
╰─────╯

We could potentially introduce a setting to disallow this behavior, however we'll examine that use when the need arises. Special thanks to @erikgeiser for the upstream PR that made this a cinch.

Closes #43.

@meowgorithm meowgorithm merged commit 4f0d448 into master Sep 3, 2021
@meowgorithm meowgorithm deleted the force-wrap branch September 3, 2021 14:20
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.

[Question] How to force text to wrap?
1 participant