lipgloss icon indicating copy to clipboard operation
lipgloss copied to clipboard

feat!(borders): add ability apply left/right borders only

Open meowgorithm opened this issue 1 year ago • 0 comments

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.

meowgorithm avatar Sep 03 '24 13:09 meowgorithm