mirror of
https://github.com/charmbracelet/lipgloss.git
synced 2024-08-17 01:40:36 +03:00
Remove setting for underlining and striking whitespace
This commit is contained in:
parent
a3ab90a71c
commit
a47a89f4ae
4
color.go
4
color.go
@ -42,8 +42,8 @@ func (c Color) value() string {
|
||||
return string(c)
|
||||
}
|
||||
|
||||
// AdaptiveColor provides color alternatives for light and dark backgrounds.
|
||||
// The appropriate color with be returned based on the darkness of the terminal
|
||||
// AdaptiveColor provides color options for light and dark backgrounds. The
|
||||
// appropriate color with be returned based on the darkness of the terminal
|
||||
// background color determined at runtime.
|
||||
//
|
||||
// Example usage:
|
||||
|
18
set.go
18
set.go
@ -466,24 +466,6 @@ func (s Style) MaxHeight(n int) Style {
|
||||
return o
|
||||
}
|
||||
|
||||
// UnderlineWhitespace determines whether to draw underlines in areas outside
|
||||
// text blocks. By default this is false, but it can be enabled for certain
|
||||
// graphic effects. Also note that whitespace can be underlined without
|
||||
// underlining text.
|
||||
func (s Style) UnderlineWhitespace(v bool) Style {
|
||||
s.set(underlineWhitespaceKey, v)
|
||||
return s
|
||||
}
|
||||
|
||||
// StrikethroughWhitespace determines whether to draw strikethroughs in areas
|
||||
// outside text blocks. By default this is false, but it can be enabled for
|
||||
// certain graphic effects. Also note that whitespace can be struck without
|
||||
// striking through text.
|
||||
func (s Style) StrikethroughWhitespace(v bool) Style {
|
||||
s.set(strikethroughWhitespaceKey, v)
|
||||
return s
|
||||
}
|
||||
|
||||
// UnderlineSpaces determines whether to underline spaces between words. By
|
||||
// default this is true. Spaces can also be underlined without underlining the
|
||||
// text itself.
|
||||
|
13
style.go
13
style.go
@ -52,8 +52,6 @@ const (
|
||||
inlineKey
|
||||
maxWidthKey
|
||||
maxHeightKey
|
||||
underlineWhitespaceKey
|
||||
strikethroughWhitespaceKey
|
||||
underlineSpacesKey
|
||||
strikethroughSpacesKey
|
||||
)
|
||||
@ -162,15 +160,12 @@ func (s Style) Render(str string) string {
|
||||
maxWidth = s.getAsInt(maxWidthKey)
|
||||
maxHeight = s.getAsInt(maxHeightKey)
|
||||
|
||||
underlineWhitespace = s.getAsBool(underlineWhitespaceKey, false)
|
||||
strikethroughWhitespace = s.getAsBool(strikethroughWhitespaceKey, false)
|
||||
|
||||
underlineSpaces = underline && s.getAsBool(underlineSpacesKey, true)
|
||||
strikethroughSpaces = strikethrough && s.getAsBool(strikethroughSpacesKey, true)
|
||||
|
||||
// Do we need to style whitespace (padding and space outsode
|
||||
// paragraphs) separately?
|
||||
styleWhitespace = reverse || underlineWhitespace || strikethroughWhitespace
|
||||
styleWhitespace = reverse
|
||||
|
||||
// Do we need to style spaces separately?
|
||||
useSpaceStyler = underlineSpaces || strikethroughSpaces
|
||||
@ -228,12 +223,6 @@ func (s Style) Render(str string) string {
|
||||
te = te.CrossOut()
|
||||
}
|
||||
|
||||
if underlineWhitespace {
|
||||
teWhitespace = teWhitespace.Underline()
|
||||
}
|
||||
if strikethroughWhitespace {
|
||||
teWhitespace = teWhitespace.CrossOut()
|
||||
}
|
||||
if underlineSpaces {
|
||||
teSpace = teSpace.Underline()
|
||||
}
|
||||
|
14
unset.go
14
unset.go
@ -275,20 +275,6 @@ func (s Style) UnsetMaxHeight() Style {
|
||||
return s
|
||||
}
|
||||
|
||||
// UnsetUnderlineWhitespace removes the rule for underlining whitespace, if
|
||||
// set.
|
||||
func (s Style) UnsetUnderlineWhitespace() Style {
|
||||
delete(s.rules, underlineSpacesKey)
|
||||
return s
|
||||
}
|
||||
|
||||
// UnsetUnderlineWhitespace removes the rule for strikingn through whitespace,
|
||||
// if set.
|
||||
func (s Style) UnsetStrikethroughWhitespace() Style {
|
||||
delete(s.rules, strikethroughSpacesKey)
|
||||
return s
|
||||
}
|
||||
|
||||
// UnsetUnderlineSpaces removes the value set by UnderlineSpaces.
|
||||
func (s Style) UnsetUnderlineSpaces() Style {
|
||||
delete(s.rules, underlineSpacesKey)
|
||||
|
Loading…
Reference in New Issue
Block a user