tstring

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2022 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package tstring contains a string type that stores style data for each character, allowing it to be rendered to a tcell screen essentially unmodified.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cell

type Cell struct {
	Char  rune
	Style tcell.Style
}

func NewCell

func NewCell(char rune) Cell

func NewColorCell

func NewColorCell(char rune, color tcell.Color) Cell

func NewStyleCell

func NewStyleCell(char rune, style tcell.Style) Cell

func (Cell) Draw

func (cell Cell) Draw(screen mauview.Screen, x, y int) (chWidth int)

func (Cell) RuneWidth

func (cell Cell) RuneWidth() int

type TString

type TString []Cell

func Join

func Join(strings []TString, separator string) TString

func NewBlankTString

func NewBlankTString() TString

func NewColorTString

func NewColorTString(str string, color tcell.Color) TString

func NewStyleTString

func NewStyleTString(str string, style tcell.Style) TString

func NewTString

func NewTString(str string) TString

func (TString) AdjustStyle

func (str TString) AdjustStyle(from, length int, fn func(tcell.Style) tcell.Style)

func (TString) AdjustStyleFull

func (str TString) AdjustStyleFull(fn func(tcell.Style) tcell.Style)

func (TString) Append

func (str TString) Append(data string) TString

func (TString) AppendColor

func (str TString) AppendColor(data string, color tcell.Color) TString

func (TString) AppendCustom

func (str TString) AppendCustom(data string, cellCreator func(rune) Cell) TString

func (TString) AppendStyle

func (str TString) AppendStyle(data string, style tcell.Style) TString

func (TString) AppendTString

func (str TString) AppendTString(dataList ...TString) TString

func (TString) Clone

func (str TString) Clone() TString

func (TString) Colorize

func (str TString) Colorize(from, length int, color tcell.Color)

func (TString) Count

func (str TString) Count(r rune) (counter int)

func (TString) Draw

func (str TString) Draw(screen mauview.Screen, x, y int)

func (TString) Index

func (str TString) Index(r rune) int

func (TString) IndexFrom

func (str TString) IndexFrom(r rune, from int) int

func (TString) Prepend

func (str TString) Prepend(data string) TString

func (TString) PrependColor

func (str TString) PrependColor(data string, color tcell.Color) TString

func (TString) PrependCustom

func (str TString) PrependCustom(data string, cellCreator func(rune) Cell) TString

func (TString) PrependStyle

func (str TString) PrependStyle(data string, style tcell.Style) TString

func (TString) PrependTString

func (str TString) PrependTString(data TString) TString

func (TString) RuneWidth

func (str TString) RuneWidth() (width int)

func (TString) Split

func (str TString) Split(sep rune) []TString

func (TString) String

func (str TString) String() string

func (TString) Trim

func (str TString) Trim(fn func(rune) bool) TString

func (TString) TrimLeft

func (str TString) TrimLeft(fn func(rune) bool) TString

func (TString) TrimRight

func (str TString) TrimRight(fn func(rune) bool) TString

func (TString) TrimSpace

func (str TString) TrimSpace() TString

func (TString) Truncate

func (str TString) Truncate(w int) TString

Truncate return string truncated with w cells

Jump to

Keyboard shortcuts

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