Documentation ¶
Index ¶
- Constants
- Variables
- func CropView(atablelist *ANSITableList, lines []*SubLine, x, y, width, height int) string
- func IsEndOfSGR(data []byte) bool
- func IsEscEnd(c rune) bool
- func IsSGR(data []byte) bool
- func ProcessContent(s string) (*ANSITableList, []*SubLine)
- func Search(list []BoundsStruct, pos int) []int
- func SliceFrom[S ~[]E, E comparable](src S, start, end int) S
- type ANSIQueueItem
- type ANSITable
- type ANSITableList
- type BoundsStruct
- type RuneData
- type RuneDataList
- type SubLine
Constants ¶
View Source
const ( ESCAPE_SEQUENCE = '\x1b' SGR_FUNC = byte('\x6d') ESCAPE_SEQUENCE_END = string(ESCAPE_SEQUENCE) + "[0" + string(SGR_FUNC) )
View Source
const LINE_SPLIT = "\n"
View Source
const TAB_RUNE = '\t'
NOTE: Planning to make these rune process function available to be set from outside
Variables ¶
View Source
var ( SPACE_HODLER = []byte(" ") SPACE_RUNEDATA = &RuneData{ Byte: SPACE_HODLER, } )
View Source
var EMPTY_ANSITABLELIST = make([]BoundsStruct, 0)
View Source
var TAB_BYTES = []byte{32, 32, 32, 32}
Functions ¶
func CropView ¶
func CropView(atablelist *ANSITableList, lines []*SubLine, x, y, width, height int) string
extract certain area of the given lines, and render ansi sequence
func IsEndOfSGR ¶
func ProcessContent ¶
func ProcessContent(s string) (*ANSITableList, []*SubLine)
separate ansi and normal string, separate lines into RuneData list
func Search ¶
func Search(list []BoundsStruct, pos int) []int
func SliceFrom ¶
func SliceFrom[S ~[]E, E comparable](src S, start, end int) S
if endIndex bigger than length, return copy of rest. mainly for cut slice easier
Types ¶
type ANSIQueueItem ¶
type ANSIQueueItem struct {
// contains filtered or unexported fields
}
type ANSITableList ¶
type ANSITableList struct {
L []BoundsStruct
}
func GetANSIs ¶
func GetANSIs(s string) (*ANSITableList, string)
split `string with ansi` into `ansi sequences` and `raw string`
func (*ANSITableList) GetSlice ¶
func (a *ANSITableList) GetSlice(startIndex, endIndex int) []BoundsStruct
get a slice of ansi table, it will find all tables between `startIndex` and `endIndex`
func (*ANSITableList) SetStyle ¶ added in v0.1.4
func (a *ANSITableList) SetStyle(style []byte, startIndex, endIndex int)
type BoundsStruct ¶
type BoundsStruct interface {
// contains filtered or unexported methods
}
type RuneDataList ¶
type RuneDataList struct { L []BoundsStruct TotalWidth int }
func (*RuneDataList) Init ¶
func (r *RuneDataList) Init(s []rune) *RuneDataList
init RuneData list given runes
RuneDataList can only be set with this function, no more process allowed afterwards
type SubLine ¶
type SubLine struct { Data *RuneDataList Bound [2]int }
Click to show internal directories.
Click to hide internal directories.