mirror of
https://github.com/gizak/termui.git
synced 2025-04-26 13:48:54 +08:00
start of TestBreakBlocksIntoStrings
This commit is contained in:
parent
33fef6cb94
commit
21dc21d403
@ -105,6 +105,18 @@ func findStartEndOfStyle(pos int, runes []rune) StyleBlock {
|
||||
return sb
|
||||
}
|
||||
|
||||
func BreakBlocksIntoStrings(s string) {
|
||||
blocks := FindStyleBlocks(s)
|
||||
fmt.Println(blocks)
|
||||
//[{5 28} {34 46} {63 75}]
|
||||
for _, b := range blocks {
|
||||
}
|
||||
s[0:4]
|
||||
s[29:33]
|
||||
s[47:62]
|
||||
s[76:77]
|
||||
}
|
||||
|
||||
func FindStyleBlocks(s string) []StyleBlock {
|
||||
items := []StyleBlock{}
|
||||
runes := []rune(s)
|
||||
|
@ -5,6 +5,10 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBreakBlocksIntoStrings(t *testing.T) {
|
||||
BreakBlocksIntoStrings("test [blue](fg:blue,mod:bold) and [red](fg:red) and maybe even [foo](bg:red)!")
|
||||
}
|
||||
|
||||
func TestFindStylePositions(t *testing.T) {
|
||||
items := FindStylePositions("test [blue](fg:blue,mod:bold) and [red](fg:red) and maybe even [foo](bg:red)!")
|
||||
if len(items) != 3 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user