Skip to content

Commit 1581527

Browse files
committed
snapshots
1 parent 8438271 commit 1581527

File tree

184 files changed

+9107
-9241
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+9107
-9241
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99

1010
### Changed
1111

12-
- Optimized startup
12+
- Optimized startup https://github.com/Textualize/textual/pull/5869
13+
- New blank visual which makes background faster to render (note this will break snapshots tests this version) https://github.com/Textualize/textual/pull/5869
1314

1415
## [3.4.0] - 2025-06-14
1516

poetry.lock

Lines changed: 232 additions & 319 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/textual/renderables/blank.py

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,39 @@
11
from __future__ import annotations
22

3-
from rich.console import Console, ConsoleOptions, RenderResult
4-
from rich.segment import Segment
5-
from rich.style import Style
3+
from rich.style import Style as RichStyle
64

75
from textual.color import Color
6+
from textual.content import Style
7+
from textual.css.styles import RulesMap
8+
from textual.selection import Selection
9+
from textual.strip import Strip
10+
from textual.visual import Visual
811

912

10-
class Blank:
13+
class Blank(Visual):
1114
"""Draw solid background color."""
1215

1316
def __init__(self, color: Color | str = "transparent") -> None:
14-
background = Color.parse(color)
15-
self._style = Style.from_color(bgcolor=background.rich_color)
16-
17-
def __rich_console__(
18-
self, console: Console, options: ConsoleOptions
19-
) -> RenderResult:
20-
width = options.max_width
21-
height = options.height or options.max_height
22-
23-
segment = Segment(" " * width, self._style)
24-
line = Segment.line()
25-
for _ in range(height):
26-
yield segment
27-
yield line
17+
self._rich_style = RichStyle.from_color(bgcolor=Color.parse(color).rich_color)
18+
19+
def visualize(self) -> Blank:
20+
return self
21+
22+
def get_optimal_width(self, rules: RulesMap, container_width: int) -> int:
23+
return container_width
24+
25+
def get_height(self, rules: RulesMap, width: int) -> int:
26+
return 1
27+
28+
def render_strips(
29+
self,
30+
rules: RulesMap,
31+
width: int,
32+
height: int | None,
33+
style: Style,
34+
selection: Selection | None = None,
35+
selection_style: Style | None = None,
36+
post_style: Style | None = None,
37+
) -> list[Strip]:
38+
line_count = 1 if height is None else height
39+
return [Strip.blank(width, self._rich_style)] * line_count

tests/snapshot_tests/__snapshots__/test_snapshots/test_add_remove_tabs.svg

Lines changed: 7 additions & 7 deletions
Loading

0 commit comments

Comments
 (0)