mirror of
https://github.com/Maks1mS/bubbles.git
synced 2025-03-13 12:33:43 +03:00
Add a lipgloss style to the viewport for borders, margins, and padding
This commit is contained in:
parent
4aed4e0a88
commit
add13c8028
@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/charmbracelet/bubbles/key"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
)
|
||||
|
||||
// NewModel returns a new model with the given width and height as well as
|
||||
@ -40,6 +41,10 @@ type Model struct {
|
||||
// window. It's used in high performance rendering only.
|
||||
YPosition int
|
||||
|
||||
// Style applies a lipgloss style to the viewport. Realistically, it's most
|
||||
// useful for setting borders, margins and padding.
|
||||
Style lipgloss.Style
|
||||
|
||||
// HighPerformanceRendering bypasses the normal Bubble Tea renderer to
|
||||
// provide higher performance rendering. Most of the time the normal Bubble
|
||||
// Tea rendering methods will suffice, but if you're passing content with
|
||||
@ -340,7 +345,7 @@ func (m Model) View() string {
|
||||
extraLines = strings.Repeat("\n", max(0, m.Height-len(lines)))
|
||||
}
|
||||
|
||||
return strings.Join(lines, "\n") + extraLines
|
||||
return m.Style.Render(strings.Join(lines, "\n") + extraLines)
|
||||
}
|
||||
|
||||
// ETC
|
||||
|
Loading…
Reference in New Issue
Block a user