Documentation ¶
Index ¶
Constants ¶
const ( // Hellip defines the string to be used as an ellipsis when the content // of the ContentBox is truncated. // It is set to "...", which is the standard representation of an ellipsis // in text. Hellip string = "..." // HellipLen defines the length of the Hellip string. // It is set to 3, which is the number of characters in the Hellip string. HellipLen int = len(Hellip) // Space defines the string to be used as a space when writing content // into the ContentBox. // It is set to " ", which is the standard representation of a space in // text. Space string = " " // FieldSpacing defines the number of spaces between each field (word) // when they are written into the ContentBox. // It is set to 1, meaning there will be one spaces between each field. FieldSpacing int = 1 // IndentLevel defines the number of spaces used for indentation when // writing content into the ContentBox. // It is set to 2, meaning there will be two spaces at the start of each // new line of content. IndentLevel int = 3 )
const ( Asterisks string = "***" AsterisksLen int = len(Asterisks) TitleMinWidth int = 2 * (AsterisksLen + 1) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContentBox ¶
type ContentBox struct {
// contains filtered or unexported fields
}
ContentBox represents a box that contains content.
func NewContentBox ¶
func NewContentBox(lines [][]string) *ContentBox
NewContentBox creates a new ContentBox with the specified lines of content.
Parameters:
- lines - a two-dimensional slice of strings representing the content of the box.
- style - the style to be used when writing the content into the box.
Returns:
- *ContentBox - a pointer to the created ContentBox.
func (*ContentBox) Runes ¶
func (cb *ContentBox) Runes(width, height int) ([][]rune, error)
Runes returns the content of the unit as a 2D slice of runes given the size of the table.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- [][]rune: The content of the unit as a 2D slice of runes.
- error: An error if the content could not be converted to runes.
Behaviors:
- Always assume that the width and height are greater than 0. No need to check for this.
- Errors are only for critical issues, such as the content not being able to be converted to runes. However, out of bounds or other issues should not error. Instead, the content should be drawn as much as possible before unable to be drawn.
type MultiLineText ¶
type MultiLineText struct {
// contains filtered or unexported fields
}
func NewMultiLineText ¶
func NewMultiLineText() *MultiLineText
func (*MultiLineText) AppendSentence ¶
func (mlt *MultiLineText) AppendSentence(sentence string) error
func (*MultiLineText) GetLines ¶
func (mlt *MultiLineText) GetLines() []string
func (*MultiLineText) IsEmpty ¶
func (mlt *MultiLineText) IsEmpty() bool
func (*MultiLineText) Runes ¶
func (mlt *MultiLineText) Runes(width, height int) ([][]rune, error)
Runes returns the content of the unit as a 2D slice of runes given the size of the table.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- [][]rune: The content of the unit as a 2D slice of runes.
- error: An error if the content could not be converted to runes.
Behaviors:
- Always assume that the width and height are greater than 0. No need to check for this.
- Errors are only for critical issues, such as the content not being able to be converted to runes. However, out of bounds or other issues should not error. Instead, the content should be drawn as much as possible before unable to be drawn.
type Title ¶
type Title struct {
// contains filtered or unexported fields
}
Title represents the header of a process or application. It contains information about the title, current process, counters, message buffer, channels for receiving messages and errors, synchronization primitives, and the width of the header.
func NewTitle ¶
NewTitle creates a new Title with the given title and a style.
Parameters:
- title: The title of the new Title.
- style: The style of the new Title.
Returns:
- *Title: The new Title.
func (*Title) GetSubtitle ¶
GetSubtitle returns the subtitle of the Title.
Returns:
- string: The subtitle of the Title.
func (*Title) GetTitle ¶
GetTitle returns the title of the Title.
Returns:
- string: The title of the Title.
func (*Title) Runes ¶
ForceDraw draws the title to the draw table.
Parameters:
- table: The draw table.
- x: The x coordinate to draw the title at.
- y: The y coordinate to draw the title at.
Returns:
- error: An error if the title could not be drawn.
func (*Title) SetSubtitle ¶
SetSubtitle sets the subtitle of the Title.
Parameters:
- subtitle: The new subtitle.
Behaviors:
- If the subtitle is an empty string, the subtitle is removed.