Extract ANSI SGR Sequences from string
Note
Tab\t
will be replaced by 4 spaces
Extract(string) -> (*ANSITableList, string)
splitstring with ansi
intoansi sequences
andraw string
Render(atl *ANSITableList, _s string, startIndex int) -> []byte
Renderstring
withansi sequences
,startIndex
is the start index of_s
which will be used to fetch ansi tableSearch(bs []BoundStruct, position int) -> (res []int)
binary search index givenBound [2]int
, the result is index.
len(res) <= 2
and-1
means reach the start/end of the slice
len(res) == 1
means the position is withinbs[res[0]].Bounds
len(res) == 2
means the position is betweenbs[res[0]].Bounds[1]
andbs[res[1]].Bounds[0]
*ANSITableList SetStyle(style []byte, startIndex, endIndex int)
set style forstring[startIndex:endIndex]