Documentation ¶
Overview ¶
Package text contains a widget that displays textual data.
Index ¶
Constants ¶
const ( DefaultScrollMouseButtonUp = mouse.ButtonWheelUp DefaultScrollMouseButtonDown = mouse.ButtonWheelDown )
The default mouse buttons for content scrolling.
const ( DefaultScrollKeyUp = keyboard.KeyArrowUp DefaultScrollKeyDown = keyboard.KeyArrowDown DefaultScrollKeyPageUp = keyboard.KeyPgUp DefaultScrollKeyPageDown = keyboard.KeyPgDn )
The default keys for content scrolling.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is used to provide options to New().
func DisableScrolling ¶
func DisableScrolling() Option
DisableScrolling disables the scrolling of the content using keyboard and mouse.
func RollContent ¶
func RollContent() Option
RollContent configures the text widget so that it rolls the text content up if more text than the size of the container is added. If not provided, the content is trimmed instead.
func ScrollKeys ¶
ScrollKeys configures the mouse buttons that scroll the content.
func ScrollMouseButtons ¶
ScrollMouseButtons configures the mouse buttons that scroll the content.
func WrapAtRunes ¶
func WrapAtRunes() Option
WrapAtRunes configures the text widget so that it automatically wraps lines that are longer than the width of the widget at rune boundaries. If not provided, long lines are trimmed instead.
type Text ¶
type Text struct {
// contains filtered or unexported fields
}
Text displays a block of text.
Each line of the text is either trimmed or wrapped according to the provided options. The entire text content is either trimmed or rolled up through the canvas according to the provided options.
By default the widget supports scrolling of content with either the keyboard or mouse. See the options for the default keys and mouse buttons.
Implements widgetapi.Widget. This object is thread-safe.
func (*Text) Keyboard ¶
func (t *Text) Keyboard(k *terminalapi.Keyboard) error
Keyboard implements widgetapi.Widget.Keyboard.
func (*Text) Mouse ¶
func (t *Text) Mouse(m *terminalapi.Mouse) error
Mouse implements widgetapi.Widget.Mouse.
func (*Text) Write ¶
func (t *Text) Write(text string, wOpts ...WriteOption) error
Write writes text for the widget to display. Multiple calls append additional text. The text contain cannot control characters (unicode.IsControl) or space character (unicode.IsSpace) other than:
' ', '\n'
Any newline ('\n') characters are interpreted as newlines when displaying the text.
type WriteOption ¶
type WriteOption interface {
// contains filtered or unexported methods
}
WriteOption is used to provide options to Write().
func WriteCellOpts ¶
func WriteCellOpts(opts ...cell.Option) WriteOption
WriteCellOpts sets options on the cells that contain the text.