Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: minor fixes to comments #147

Merged
merged 1 commit into from Oct 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 10 additions & 10 deletions get.go
Expand Up @@ -6,42 +6,42 @@ import (
"github.com/muesli/reflow/ansi"
)

// GetBold returns the style's bold value It no value is set false is returned.
// GetBold returns the style's bold value. If no value is set false is returned.
func (s Style) GetBold() bool {
return s.getAsBool(boldKey, false)
}

// GetItalic returns the style's italic value. It no value is set false is
// GetItalic returns the style's italic value. If no value is set false is
// returned.
func (s Style) GetItalic() bool {
return s.getAsBool(italicKey, false)
}

// GetUnderline returns the style's underline value. It no value is set false is
// GetUnderline returns the style's underline value. If no value is set false is
// returned.
func (s Style) GetUnderline() bool {
return s.getAsBool(underlineKey, false)
}

// GetStrikethrough returns the style's strikethrough value. It no value is set false
// GetStrikethrough returns the style's strikethrough value. If no value is set false
// is returned.
func (s Style) GetStrikethrough() bool {
return s.getAsBool(strikethroughKey, false)
}

// GetReverse returns the style's reverse value. It no value is set false is
// GetReverse returns the style's reverse value. If no value is set false is
// returned.
func (s Style) GetReverse() bool {
return s.getAsBool(reverseKey, false)
}

// GetBlink returns the style's blink value. It no value is set false is
// GetBlink returns the style's blink value. If no value is set false is
// returned.
func (s Style) GetBlink() bool {
return s.getAsBool(blinkKey, false)
}

// GetFaint returns the style's faint value. It no value is set false is
// GetFaint returns the style's faint value. If no value is set false is
// returned.
func (s Style) GetFaint() bool {
return s.getAsBool(faintKey, false)
Expand Down Expand Up @@ -72,7 +72,7 @@ func (s Style) GetHeight() int {
}

// GetAlign returns the style's implicit horizontal alignment setting.
// If no alignment is set Position.AlignLeft is returned.
// If no alignment is set Position.Left is returned.
func (s Style) GetAlign() Position {
v := s.getAsPosition(alignHorizontalKey)
if v == Position(0) {
Expand All @@ -82,7 +82,7 @@ func (s Style) GetAlign() Position {
}

// GetAlignHorizontal returns the style's implicit horizontal alignment setting.
// If no alignment is set Position.AlignLeft is returned.
// If no alignment is set Position.Left is returned.
func (s Style) GetAlignHorizontal() Position {
v := s.getAsPosition(alignHorizontalKey)
if v == Position(0) {
Expand All @@ -92,7 +92,7 @@ func (s Style) GetAlignHorizontal() Position {
}

// GetAlignVertical returns the style's implicit vertical alignment setting.
// If no alignment is set Position.AlignTop is returned.
// If no alignment is set Position.Top is returned.
func (s Style) GetAlignVertical() Position {
v := s.getAsPosition(alignVerticalKey)
if v == Position(0) {
Expand Down
2 changes: 1 addition & 1 deletion runes.go
Expand Up @@ -4,7 +4,7 @@ import (
"strings"
)

// StyleRunes applys a given style to runes at the given indicesin the string.
// StyleRunes applys a given style to runes at the given indices in the string.
// Note that you must provide styling options for both matched and unmatched
// runes. Indices out of bounds will be ignored.
func StyleRunes(str string, indices []int, matched, unmatched Style) string {
Expand Down
4 changes: 2 additions & 2 deletions set.go
Expand Up @@ -39,15 +39,15 @@ func (s Style) Italic(v bool) Style {

// Underline sets an underline rule. By default, underlines will not be drawn on
// whitespace like margins and padding. To change this behavior set
// renderUnderlinesOnSpaces.
// UnderlineSpaces.
func (s Style) Underline(v bool) Style {
s.set(underlineKey, v)
return s
}

// Strikethrough sets a strikethrough rule. By default, strikes will not be
// drawn on whitespace like margins and padding. To change this behavior set
// renderStrikethroughOnSpaces.
// StrikethroughSpaces.
Comment on lines -42 to +50
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were the only ones which did not seem obvious. After poking around in the history I did not find any reference to renderUnderlinesOnSpaces or renderStrikethroughOnSpaces, so this is my guess about the correct comment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe your change is correct. Setting the UnderlineSpaces and StrikethroughSpaces is the right approach, I think the comment was affected by a find + replace. The user would not be able to set the previous methods anyway since they are not exported.

func (s Style) Strikethrough(v bool) Style {
s.set(strikethroughKey, v)
return s
Expand Down
2 changes: 1 addition & 1 deletion style.go
Expand Up @@ -432,7 +432,7 @@ func padLeft(str string, n int, style *termenv.Style) string {
return b.String()
}

// Apply right right padding.
// Apply right padding.
func padRight(str string, n int, style *termenv.Style) string {
if n == 0 || str == "" {
return str
Expand Down