Skip to content

Commit aa19a51

Browse files
committed
small potatoes
1 parent 2e46624 commit aa19a51

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/textual/markup.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -413,18 +413,19 @@ def process_text(template_text: str, /) -> str:
413413

414414
content_text = "".join(text)
415415
text_length = len(content_text)
416-
spans.extend(
417-
[
418-
Span(position, text_length, tag_body)
419-
for position, tag_body, _ in reversed(style_stack)
420-
]
421-
)
416+
if style_stack:
417+
spans.extend(
418+
[
419+
Span(position, text_length, tag_body)
420+
for position, tag_body, _ in reversed(style_stack)
421+
]
422+
)
422423
spans.reverse()
423424
spans.sort(key=itemgetter(0)) # Zeroth item of Span is 'start' attribute
424425

425426
content = Content(
426427
content_text,
427-
[Span(0, len(content_text), style), *spans] if style else spans,
428+
[Span(0, text_length, style), *spans] if style else spans,
428429
)
429430

430431
return content

0 commit comments

Comments
 (0)