Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion list/list.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Package list allows you to build lists, as simple or complicated as you need.
//
// Simply, define a list with some items and set it's rendering properties, like
// Simply, define a list with some items and set its rendering properties, like
// enumerator and styling:
//
// groceries := list.New(
Expand Down
12 changes: 6 additions & 6 deletions table/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ func (t *Table) ClearRows() *Table {
return t
}

// StyleFunc sets the style for a cell based on it's position (row, column).
// StyleFunc sets the style for a cell based on its position (row, column).
func (t *Table) StyleFunc(style StyleFunc) *Table {
t.styleFunc = style
return t
}

// style returns the style for a cell based on it's position (row, column).
// style returns the style for a cell based on its position (row, column).
func (t *Table) style(row, col int) lipgloss.Style {
if t.styleFunc == nil {
return lipgloss.NewStyle()
Expand Down Expand Up @@ -293,7 +293,7 @@ func (t *Table) String() string {
Render(sb.String())
}

// computeHeight computes the height of the table in it's current configuration.
// computeHeight computes the height of the table in its current configuration.
func (t *Table) computeHeight() int {
hasHeaders := len(t.headers) > 0
return sum(t.heights) - 1 + btoi(hasHeaders) +
Expand All @@ -306,7 +306,7 @@ func (t *Table) Render() string {
return t.String()
}

// constructTopBorder constructs the top border for the table given it's current
// constructTopBorder constructs the top border for the table given its current
// border configuration and data.
func (t *Table) constructTopBorder() string {
var s strings.Builder
Expand All @@ -325,7 +325,7 @@ func (t *Table) constructTopBorder() string {
return s.String()
}

// constructBottomBorder constructs the bottom border for the table given it's current
// constructBottomBorder constructs the bottom border for the table given its current
// border configuration and data.
func (t *Table) constructBottomBorder() string {
var s strings.Builder
Expand All @@ -344,7 +344,7 @@ func (t *Table) constructBottomBorder() string {
return s.String()
}

// constructHeaders constructs the headers for the table given it's current
// constructHeaders constructs the headers for the table given its current
// header configuration and data.
func (t *Table) constructHeaders() string {
height := t.heights[HeaderRow+1]
Expand Down
4 changes: 2 additions & 2 deletions table/table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ func TestTableHeights(t *testing.T) {
rows := [][]string{
{"Chutar o balde", `Literally translates to "kick the bucket." It's used when someone gives up or loses patience.`},
{"Engolir sapos", `Literally means "to swallow frogs." It's used to describe someone who has to tolerate or endure unpleasant situations.`},
{"Arroz de festa", `Literally means "party rice." It´s used to refer to someone who shows up everywhere.`},
{"Arroz de festa", `Literally means "party rice." It's used to refer to someone who shows up everywhere.`},
}

table := New().
Expand Down Expand Up @@ -404,7 +404,7 @@ func TestTableMultiLineRowSeparator(t *testing.T) {
BorderRow(true).
Row("Chutar o balde", `Literally translates to "kick the bucket." It's used when someone gives up or loses patience.`).
Row("Engolir sapos", `Literally means "to swallow frogs." It's used to describe someone who has to tolerate or endure unpleasant situations.`).
Row("Arroz de festa", `Literally means "party rice." It´s used to refer to someone who shows up everywhere.`)
Row("Arroz de festa", `Literally means "party rice." It's used to refer to someone who shows up everywhere.`)

golden.RequireEqual(t, []byte(table.String()))
}
Expand Down
2 changes: 1 addition & 1 deletion table/testdata/TestTableHeights.golden

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion table/testdata/TestTableMultiLineRowSeparator.golden

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tree/renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ func (r *renderer) render(node Node, root bool, prefix string) string {
enumerator := r.enumerator
indenter := r.indenter

// print the root node name if its not empty.
// print the root node name if it's not empty.
if name := node.Value(); name != "" && root {
strs = append(strs, r.style.root.Render(name))
}

for i := 0; i < children.Length(); i++ {
if i < children.Length()-1 {
if child := children.At(i + 1); child.Hidden() {
// Don't count the last child if its hidden. This renders the
// Don't count the last child if it's hidden. This renders the
// last visible element with the right prefix
//
// The only type of Children is NodeChildren.
Expand Down
2 changes: 1 addition & 1 deletion tree/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (t *Tree) String() string {

// Child adds a child to this Tree.
//
// If a Child Tree is passed without a root, it will be parented to it's sibling
// If a Child Tree is passed without a root, it will be parented to its sibling
// child (auto-nesting).
//
// tree.Root("Foo").Child("Bar", tree.New().Child("Baz"), "Qux")
Expand Down