Documentation ¶
Index ¶
- Constants
- Variables
- func IsEndOfSGR(data []byte) bool
- func IsEscEnd(c rune) bool
- func IsSGR(data []byte) bool
- func Render(atl *ANSITableList, _s string, startIndex int) []byte
- 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
Constants ¶
View Source
const ( ESCAPE_SEQUENCE = '\x1b' SGR_FUNC = byte('\x6d') ESCAPE_SEQUENCE_END = string(ESCAPE_SEQUENCE) + "[0" + string(SGR_FUNC) )
View Source
const TAB_RUNE = '\t'
NOTE: Planning to make these rune process function available to be set from outside
Variables ¶
View Source
var EMPTY_ANSITABLELIST = make([]BoundsStruct, 0)
View Source
var TAB_BYTES = []byte{32, 32, 32, 32}
Functions ¶
func IsEndOfSGR ¶
func Search ¶
func Search(list []BoundsStruct, pos int) []int
binary search index given `Bound [2]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 Extract ¶
func Extract(s string) (*ANSITableList, string)
split `string with ansi` into `ansi sequences` and `raw string`, Ps: tab will be replaced by 4 spaces
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 ¶
func (a *ANSITableList) SetStyle(style []byte, startIndex, endIndex int)
type BoundsStruct ¶
type BoundsStruct interface {
GetBounds() [2]int
}
Click to show internal directories.
Click to hide internal directories.