Source File
size.go
Belonging Package
charm.land/lipgloss/v2
package lipglossimport ()// Width returns the cell width of characters in the string. ANSI sequences are// ignored and characters wider than one cell (such as Chinese characters and// emojis) are appropriately measured.//// You should use this instead of len(string) or len([]rune(string) as neither// will give you accurate results.func ( string) ( int) {for := range strings.SplitSeq(, "\n") {:= ansi.StringWidth()if > {=}}return}// 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].func ( string) int {return strings.Count(, "\n") + 1}// Size returns the width and height of the string in cells. ANSI sequences are// ignored and characters wider than one cell (such as Chinese characters and// emojis) are appropriately measured.func ( string) (, int) {= Width()= Height()return ,}
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64)