Skip to content
Open
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
6 changes: 3 additions & 3 deletions size.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ func Width(str string) (width int) {
return width
}

// Height returns height of a string in cells. This is done simply by
// counting \n characters. If your output has \r\n, that sequence will be
// replaced with a \n in [Style.Render].
// Height returns height of a string in cells, calculated simply
// as 1 plus the number of \n characters. If your output has \r\n,
// that sequence will be replaced with a \n in [Style.Render].
func Height(str string) int {
return strings.Count(str, "\n") + 1
}
Expand Down