textwidget

package
v0.0.0-...-4b9fd1c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendTextSpans

func AppendTextSpans(text *Text, spans ...Span)

Types

type Line

type Line struct {
	Style     bento.Style
	Spans     []Span
	Alignment bento.Alignment
}

func NewLine

func NewLine(spans ...Span) Line

func NewLineStr

func NewLineStr(s string) Line

func (Line) Center

func (l Line) Center() Line

func (Line) Left

func (l Line) Left() Line

func (Line) Print

func (l Line) Print(buffer *bento.Buffer, x, y, maxWidth int) (int, int)

Print a line, starting at the position (x, y)

func (Line) Render

func (l Line) Render(area bento.Rect, buffer *bento.Buffer)

func (Line) Right

func (l Line) Right() Line

func (Line) String

func (l Line) String() string

func (Line) StyledGraphemes

func (l Line) StyledGraphemes(baseStyle bento.Style) []StyledGrapheme

func (Line) Width

func (l Line) Width() int

func (Line) WithAlignment

func (l Line) WithAlignment(alignment bento.Alignment) Line

func (Line) WithSpans

func (l Line) WithSpans(spans ...Span) Line

func (Line) WithSpansStr

func (l Line) WithSpansStr(spans ...string) Line

func (Line) WithStyle

func (l Line) WithStyle(style bento.Style) Line

type Lines

type Lines []Line

func NewLines

func NewLines(lines ...Line) Lines

func NewLinesStr

func NewLinesStr(s ...string) Lines

func (Lines) Height

func (l Lines) Height() int

func (Lines) NewBuffer

func (l Lines) NewBuffer() bento.Buffer

func (Lines) String

func (l Lines) String() string

func (Lines) Width

func (l Lines) Width() int

type Span

type Span struct {
	Style   bento.Style
	Content string
}

func NewSpan

func NewSpan(v string) Span

func (Span) Print

func (s Span) Print(buffer *bento.Buffer, x, y, maxWidth int) (int, int)

func (Span) Render

func (s Span) Render(area bento.Rect, buffer *bento.Buffer)

func (Span) String

func (s Span) String() string

func (Span) StyledGraphemes

func (s Span) StyledGraphemes(style bento.Style) []StyledGrapheme

func (Span) Width

func (s Span) Width() int

func (Span) WithStyle

func (s Span) WithStyle(style bento.Style) Span

func (Span) WithStylePatch

func (s Span) WithStylePatch(patch bento.Style) Span

type StyledGrapheme

type StyledGrapheme struct {
	grapheme.Grapheme

	Style bento.Style
}

type Text

type Text struct {
	Style     bento.Style
	Lines     Lines
	Alignment bento.Alignment
}

func NewText

func NewText(lines ...Line) Text

func NewTextStr

func NewTextStr(s string) Text

func (Text) Center

func (t Text) Center() Text

func (Text) Height

func (t Text) Height() int

func (Text) Left

func (t Text) Left() Text

func (Text) Render

func (t Text) Render(area bento.Rect, buffer *bento.Buffer)

Render implements bento.Widget.

func (Text) Right

func (t Text) Right() Text

func (Text) String

func (t Text) String() string

func (Text) Width

func (t Text) Width() int

func (Text) WithAlignment

func (t Text) WithAlignment(alignment bento.Alignment) Text

func (Text) WithLines

func (t Text) WithLines(lines ...Line) Text

func (Text) WithLinesStr

func (t Text) WithLinesStr(lines ...string) Text

func (Text) WithStyle

func (t Text) WithStyle(style bento.Style) Text

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL