Skip to content

Commit 1b21579

Browse files
committed
For convenience, handle Str:D children in span-tree()
1 parent 34c7d0f commit 1b21579

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/Terminal/Widgets/TextContent.rakumod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ our sub interpolant-span(Str:D $var-name, :%flags, *%attributes) is export {
237237

238238
#| Helper function to build up a SpanTree with SemanticSpan leaves
239239
our sub span-tree(*@children, *%attributes) is export {
240-
SpanTree.new(:@children, :%attributes)
240+
my @ss = @children.map({ $_ ~~ Str:D ?? string-span($_) !! $_ });
241+
SpanTree.new(children => @ss, :%attributes)
241242
}
242243

243244
#| Helper function to turn a plain Str into a parseable MarkupString

0 commit comments

Comments
 (0)