mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
adds Strip primitive
This commit is contained in:
@@ -4,13 +4,14 @@ from rich.segment import Segment
|
||||
from rich.style import Style
|
||||
|
||||
from textual._styles_cache import StylesCache
|
||||
from textual._types import Lines
|
||||
from textual._types import Strips
|
||||
from textual.color import Color
|
||||
from textual.css.styles import Styles
|
||||
from textual.geometry import Region, Size
|
||||
from textual.strip import Strip
|
||||
|
||||
|
||||
def _extract_content(lines: Lines):
|
||||
def _extract_content(lines: Strips):
|
||||
"""Extract the text content from lines."""
|
||||
content = ["".join(segment.text for segment in line) for line in lines]
|
||||
return content
|
||||
@@ -44,10 +45,11 @@ def test_no_styles():
|
||||
)
|
||||
style = Style.from_color(bgcolor=Color.parse("green").rich_color)
|
||||
expected = [
|
||||
[Segment("foo", style)],
|
||||
[Segment("bar", style)],
|
||||
[Segment("baz", style)],
|
||||
Strip([Segment("foo", style)], 3),
|
||||
Strip([Segment("bar", style)], 3),
|
||||
Strip([Segment("baz", style)], 3),
|
||||
]
|
||||
|
||||
assert lines == expected
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user