mirror of
https://github.com/charmbracelet/lipgloss.git
synced 2024-10-04 01:37:49 +03:00
docs: fix typos and clean up comments (#182)
This commit is contained in:
parent
53cc780a5a
commit
303724f7da
2
color.go
2
color.go
@ -146,7 +146,7 @@ func (c CompleteColor) RGBA() (r, g, b, a uint32) {
|
||||
return termenv.ConvertToRGB(c.color(renderer)).RGBA()
|
||||
}
|
||||
|
||||
// CompleteColor specifies exact values for truecolor, ANSI256, and ANSI color
|
||||
// CompleteAdaptiveColor specifies exact values for truecolor, ANSI256, and ANSI color
|
||||
// profiles, with separate options for light and dark backgrounds. Automatic
|
||||
// color degradation will not be performed.
|
||||
type CompleteAdaptiveColor struct {
|
||||
|
18
get.go
18
get.go
@ -53,7 +53,7 @@ func (s Style) GetForeground() TerminalColor {
|
||||
return s.getAsColor(foregroundKey)
|
||||
}
|
||||
|
||||
// GetBackground returns the style's back color. If no value is set
|
||||
// GetBackground returns the style's background color. If no value is set
|
||||
// NoColor{} is returned.
|
||||
func (s Style) GetBackground() TerminalColor {
|
||||
return s.getAsColor(backgroundKey)
|
||||
@ -191,7 +191,7 @@ func (s Style) GetHorizontalMargins() int {
|
||||
return s.getAsInt(marginLeftKey) + s.getAsInt(marginRightKey)
|
||||
}
|
||||
|
||||
// GetVerticalMargins returns the style's top and bottom padding. Unset values
|
||||
// GetVerticalMargins returns the style's top and bottom margins. Unset values
|
||||
// are measured as 0.
|
||||
func (s Style) GetVerticalMargins() int {
|
||||
return s.getAsInt(marginTopKey) + s.getAsInt(marginBottomKey)
|
||||
@ -257,7 +257,7 @@ func (s Style) GetBorderBottomForeground() TerminalColor {
|
||||
return s.getAsColor(borderBottomForegroundKey)
|
||||
}
|
||||
|
||||
// GetBorderLeftForeground returns the style's border bottom foreground
|
||||
// GetBorderLeftForeground returns the style's border left foreground
|
||||
// color. If no value is set NoColor{} is returned.
|
||||
func (s Style) GetBorderLeftForeground() TerminalColor {
|
||||
return s.getAsColor(borderLeftForegroundKey)
|
||||
@ -281,7 +281,7 @@ func (s Style) GetBorderBottomBackground() TerminalColor {
|
||||
return s.getAsColor(borderBottomBackgroundKey)
|
||||
}
|
||||
|
||||
// GetBorderLeftBackground returns the style's border bottom background
|
||||
// GetBorderLeftBackground returns the style's border left background
|
||||
// color. If no value is set NoColor{} is returned.
|
||||
func (s Style) GetBorderLeftBackground() TerminalColor {
|
||||
return s.getAsColor(borderLeftBackgroundKey)
|
||||
@ -344,9 +344,9 @@ func (s Style) GetHorizontalBorderSize() int {
|
||||
return b.GetLeftSize() + b.GetRightSize()
|
||||
}
|
||||
|
||||
// GetVerticalBorderSize returns the width of the horizontal borders. If
|
||||
// GetVerticalBorderSize returns the width of the vertical borders. If
|
||||
// borders contain runes of varying widths, the widest rune is returned. If no
|
||||
// border exists on the horizontal edges, 0 is returned.
|
||||
// border exists on the vertical edges, 0 is returned.
|
||||
func (s Style) GetVerticalBorderSize() int {
|
||||
b := s.getBorderStyle()
|
||||
return b.GetTopSize() + b.GetBottomSize()
|
||||
@ -364,7 +364,7 @@ func (s Style) GetMaxWidth() int {
|
||||
return s.getAsInt(maxWidthKey)
|
||||
}
|
||||
|
||||
// GetMaxHeight returns the style's max width setting. If no value is set 0 is
|
||||
// GetMaxHeight returns the style's max height setting. If no value is set 0 is
|
||||
// returned.
|
||||
func (s Style) GetMaxHeight() int {
|
||||
return s.getAsInt(maxHeightKey)
|
||||
@ -376,7 +376,7 @@ func (s Style) GetUnderlineSpaces() bool {
|
||||
return s.getAsBool(underlineSpacesKey, false)
|
||||
}
|
||||
|
||||
// GetStrikethroughSpaces returns whether or not the style is set to underline
|
||||
// GetStrikethroughSpaces returns whether or not the style is set to strikethrough
|
||||
// spaces. If not value is set false is returned.
|
||||
func (s Style) GetStrikethroughSpaces() bool {
|
||||
return s.getAsBool(strikethroughSpacesKey, false)
|
||||
@ -390,7 +390,7 @@ func (s Style) GetHorizontalFrameSize() int {
|
||||
return s.GetHorizontalMargins() + s.GetHorizontalPadding() + s.GetHorizontalBorderSize()
|
||||
}
|
||||
|
||||
// GetVerticalFrameSize returns the sum of the style's horizontal margins, padding
|
||||
// GetVerticalFrameSize returns the sum of the style's vertical margins, padding
|
||||
// and border widths.
|
||||
//
|
||||
// Provisional: this method may be renamed.
|
||||
|
@ -9,7 +9,7 @@ func TestJoinVertical(t *testing.T) {
|
||||
expected string
|
||||
}
|
||||
tests := []test{
|
||||
{"por0", JoinVertical(0, "A", "BBBB"), "A \nBBBB"},
|
||||
{"pos0", JoinVertical(0, "A", "BBBB"), "A \nBBBB"},
|
||||
{"pos1", JoinVertical(1, "A", "BBBB"), " A\nBBBB"},
|
||||
{"pos0.25", JoinVertical(0.25, "A", "BBBB"), " A \nBBBB"},
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ func PlaceHorizontal(width int, pos Position, str string, opts ...WhitespaceOpti
|
||||
|
||||
// PlaceHorizontal places a string or text block horizontally in an unstyled
|
||||
// block of a given width. If the given width is shorter than the max width of
|
||||
// the string (measured by it's longest line) this will be a noöp.
|
||||
// the string (measured by its longest line) this will be a noöp.
|
||||
func (r *Renderer) PlaceHorizontal(width int, pos Position, str string, opts ...WhitespaceOption) string {
|
||||
lines, contentWidth := getLines(str)
|
||||
gap := width - contentWidth
|
||||
@ -106,7 +106,7 @@ func PlaceVertical(height int, pos Position, str string, opts ...WhitespaceOptio
|
||||
|
||||
// PlaceVertical places a string or text block vertically in an unstyled block
|
||||
// of a given height. If the given height is shorter than the height of the
|
||||
// string (measured by it's newlines) then this will be a noöp.
|
||||
// string (measured by its newlines) then this will be a noöp.
|
||||
func (r *Renderer) PlaceVertical(height int, pos Position, str string, opts ...WhitespaceOption) string {
|
||||
contentHeight := strings.Count(str, "\n") + 1
|
||||
gap := height - contentHeight
|
||||
|
2
set.go
2
set.go
@ -126,7 +126,7 @@ func (s Style) AlignHorizontal(p Position) Style {
|
||||
return s
|
||||
}
|
||||
|
||||
// AlignVertical sets a text alignment rule.
|
||||
// AlignVertical sets a vertical text alignment rule.
|
||||
func (s Style) AlignVertical(p Position) Style {
|
||||
s.set(alignVerticalKey, p)
|
||||
return s
|
||||
|
4
unset.go
4
unset.go
@ -30,7 +30,7 @@ func (s Style) UnsetReverse() Style {
|
||||
return s
|
||||
}
|
||||
|
||||
// UnsetBlink removes the bold style rule, if set.
|
||||
// UnsetBlink removes the blink style rule, if set.
|
||||
func (s Style) UnsetBlink() Style {
|
||||
delete(s.rules, blinkKey)
|
||||
return s
|
||||
@ -112,7 +112,7 @@ func (s Style) UnsetPaddingTop() Style {
|
||||
return s
|
||||
}
|
||||
|
||||
// UnsetPaddingBottom removes the bottom style rule, if set.
|
||||
// UnsetPaddingBottom removes the bottom padding style rule, if set.
|
||||
func (s Style) UnsetPaddingBottom() Style {
|
||||
delete(s.rules, paddingBottomKey)
|
||||
return s
|
||||
|
@ -15,7 +15,7 @@ type whitespace struct {
|
||||
}
|
||||
|
||||
// newWhitespace creates a new whitespace renderer. The order of the options
|
||||
// matters, it you'r using WithWhitespaceRenderer, make sure it comes first as
|
||||
// matters, if you're using WithWhitespaceRenderer, make sure it comes first as
|
||||
// other options might depend on it.
|
||||
func newWhitespace(r *Renderer, opts ...WhitespaceOption) *whitespace {
|
||||
w := &whitespace{
|
||||
|
Loading…
Reference in New Issue
Block a user