mirror of
https://github.com/charmbracelet/lipgloss.git
synced 2024-11-27 11:43:06 +03:00
Remove the gaps and add the periods that the linter wants
This commit is contained in:
parent
408a26e349
commit
3b2c9574ca
2
align.go
2
align.go
@ -21,7 +21,6 @@ func alignText(str string, pos Position, width int, style *termenv.Style) string
|
||||
shortAmount += max(0, width-(shortAmount+lineWidth)) // difference from the total width, if set
|
||||
|
||||
if shortAmount > 0 {
|
||||
|
||||
switch pos {
|
||||
case Right:
|
||||
s := strings.Repeat(" ", shortAmount)
|
||||
@ -54,7 +53,6 @@ func alignText(str string, pos Position, width int, style *termenv.Style) string
|
||||
if i < len(lines)-1 {
|
||||
b.WriteRune('\n')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return b.String()
|
||||
|
@ -20,10 +20,10 @@ const (
|
||||
columnWidth = 30
|
||||
)
|
||||
|
||||
// Style definitions
|
||||
// Style definitions.
|
||||
var (
|
||||
|
||||
// General
|
||||
// General.
|
||||
|
||||
subtle = lipgloss.AdaptiveColor{Light: "#D9DCCF", Dark: "#383838"}
|
||||
highlight = lipgloss.AdaptiveColor{Light: "#874BFD", Dark: "#7D56F4"}
|
||||
@ -37,7 +37,7 @@ var (
|
||||
|
||||
url = lipgloss.NewStyle().Foreground(special).Render
|
||||
|
||||
// Tabs
|
||||
// Tabs.
|
||||
|
||||
activeTabBorder = lipgloss.Border{
|
||||
Top: "─",
|
||||
@ -73,7 +73,7 @@ var (
|
||||
BorderLeft(false).
|
||||
BorderRight(false)
|
||||
|
||||
// Title
|
||||
// Title.
|
||||
|
||||
titleStyle = lipgloss.NewStyle().
|
||||
MarginLeft(1).
|
||||
@ -90,7 +90,7 @@ var (
|
||||
BorderTop(true).
|
||||
BorderForegroundColor(subtle)
|
||||
|
||||
// Dialog
|
||||
// Dialog.
|
||||
|
||||
dialogBoxStyle = lipgloss.NewStyle().
|
||||
Border(lipgloss.RoundedBorder()).
|
||||
@ -113,7 +113,7 @@ var (
|
||||
MarginRight(2).
|
||||
Underline(true)
|
||||
|
||||
// List
|
||||
// List.
|
||||
|
||||
list = lipgloss.NewStyle().
|
||||
Border(lipgloss.NormalBorder(), false, true, false, false).
|
||||
@ -143,7 +143,7 @@ var (
|
||||
Render(s)
|
||||
}
|
||||
|
||||
// Paragraphs/History
|
||||
// Paragraphs/History.
|
||||
|
||||
historyStyle = lipgloss.NewStyle().
|
||||
Align(lipgloss.Left).
|
||||
@ -154,7 +154,7 @@ var (
|
||||
Height(19).
|
||||
Width(columnWidth)
|
||||
|
||||
// Status Bar
|
||||
// Status Bar.
|
||||
|
||||
statusNugget = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#FFFDF5")).
|
||||
@ -179,7 +179,7 @@ var (
|
||||
|
||||
fishCakeStyle = statusNugget.Copy().Background(lipgloss.Color("#6124DF"))
|
||||
|
||||
// Page
|
||||
// Page.
|
||||
|
||||
docStyle = lipgloss.NewStyle().Padding(1, 2, 1, 2)
|
||||
)
|
||||
|
@ -55,12 +55,10 @@ func PlaceHorizontal(width int, pos Position, str string, opts ...WhitespaceOpti
|
||||
|
||||
var b strings.Builder
|
||||
for i, l := range lines {
|
||||
|
||||
// Is this line shorter than the longest line?
|
||||
short := max(0, contentWidth-ansi.PrintableRuneWidth(l))
|
||||
|
||||
switch pos {
|
||||
|
||||
case Left:
|
||||
b.WriteString(l)
|
||||
b.WriteString(ws.render(gap + short))
|
||||
@ -110,7 +108,6 @@ func PlaceVertical(height int, pos Position, str string, opts ...WhitespaceOptio
|
||||
b := strings.Builder{}
|
||||
|
||||
switch pos {
|
||||
|
||||
case Top:
|
||||
b.WriteString(str)
|
||||
b.WriteRune('\n')
|
||||
@ -137,7 +134,6 @@ func PlaceVertical(height int, pos Position, str string, opts ...WhitespaceOptio
|
||||
b.WriteRune('\n')
|
||||
b.WriteString(emptyLine)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return b.String()
|
||||
|
3
set.go
3
set.go
@ -222,6 +222,7 @@ func (s Style) MarginBottom(i int) Style {
|
||||
return s
|
||||
}
|
||||
|
||||
// marginBackground sets the background color of the margin.
|
||||
func (s Style) marginBackground(c TerminalColor) Style {
|
||||
s.set(marginBackgroundKey, c)
|
||||
return s
|
||||
@ -503,7 +504,7 @@ func (s Style) StrikethroughSpaces(v bool) Style {
|
||||
// 2 args: top -> bottom
|
||||
// 3 args: top -> horizontal -> bottom
|
||||
// 4 args: top -> right -> bottom -> left
|
||||
// 5+ args: do nothing
|
||||
// 5+ args: do nothing.
|
||||
func whichSidesInt(i ...int) (top, right, bottom, left int, ok bool) {
|
||||
switch len(i) {
|
||||
case 1:
|
||||
|
12
style.go
12
style.go
@ -27,7 +27,7 @@ const (
|
||||
heightKey
|
||||
alignKey
|
||||
|
||||
// Padding
|
||||
// Padding.
|
||||
paddingTopKey
|
||||
paddingRightKey
|
||||
paddingBottomKey
|
||||
@ -35,29 +35,29 @@ const (
|
||||
|
||||
colorWhitespaceKey
|
||||
|
||||
// Margins
|
||||
// Margins.
|
||||
marginTopKey
|
||||
marginRightKey
|
||||
marginBottomKey
|
||||
marginLeftKey
|
||||
marginBackgroundKey
|
||||
|
||||
// Border runes
|
||||
// Border runes.
|
||||
borderStyleKey
|
||||
|
||||
// Border edges
|
||||
// Border edges.
|
||||
borderTopKey
|
||||
borderRightKey
|
||||
borderBottomKey
|
||||
borderLeftKey
|
||||
|
||||
// Border foreground colors
|
||||
// Border foreground colors.
|
||||
borderTopFGColorKey
|
||||
borderRightFGColorKey
|
||||
borderBottomFGColorKey
|
||||
borderLeftFGColorKey
|
||||
|
||||
// Border background colors
|
||||
// Border background colors.
|
||||
borderTopBGColorKey
|
||||
borderRightBGColorKey
|
||||
borderBottomBGColorKey
|
||||
|
Loading…
Reference in New Issue
Block a user