1
0
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:
Andrew Arrow 2022-11-08 13:46:07 -08:00
parent 33fef6cb94
commit 21dc21d403
2 changed files with 16 additions and 0 deletions

View File

@ -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)

View File

@ -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 {