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!(borders): add ability apply left/right borders only #360

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

Conversation

meowgorithm
Copy link
Member

Horizontal Borders Only

This set of revision fixes some quirks with the border algorithm allowing you to set left and right borders only using various logical techniques:

// Renders「你好」
s := lipgloss.NewStyle().
    BorderStyle({Left: "「", Right: "」").
    Render("你好")

// Renders │Hello│
s = lipgloss.NewStyle().
    BorderStyle(lipgloss.NormalBorder()).
    BorderLeft(true).
    BorderRight(true).
    Render("Hello")

fmt.Println(s) 

// Renders
// │ Ciao  │
// │ Bella │
s = lipgloss.NewStyle().
    BorderStyle(lipgloss.NormalBorder()).
    Inline(true).
    Padding(1).
    Render("Ciao\nBella")

This changes the way the render works slighly, but for all intents and
purposes the impact should be little to none.

Also included are a series of border tests.

Previously, inline mode would obliterate borders altogether.

This changes the way the render works slighly, but for all intents and
purposes the impact should be little to none.
In other words, when determining which sides need borders, don't factor
in the middle section that was added to support tables.
If the top and bottom borders are missing the left and right borders
will now render. If the text value rendered is one line, this will
essentially work akin to inline mode.
@meowgorithm meowgorithm marked this pull request as draft September 3, 2024 15:40
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