File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -220,7 +220,6 @@ def wrap(
220
220
selection : Selection | None = None ,
221
221
selection_style : Style | None = None ,
222
222
) -> list [ContentLine ]:
223
- # lines: list[Content] = []
224
223
output_lines : list [ContentLine ] = []
225
224
226
225
if selection is not None :
@@ -1065,7 +1064,9 @@ def to_strip(self, style: Style) -> Strip:
1065
1064
return strip
1066
1065
1067
1066
segments : list [Segment ] = (
1068
- [Segment (" " * pad_left , base_rich_style )] if pad_left else []
1067
+ [Segment (" " * pad_left , style .background_style .rich_style )]
1068
+ if pad_left
1069
+ else []
1069
1070
)
1070
1071
add_segment = segments .append
1071
1072
for text , text_style in content .render (style , end = "" ):
@@ -1075,7 +1076,9 @@ def to_strip(self, style: Style) -> Strip:
1075
1076
x += len (text )
1076
1077
1077
1078
if pad_right :
1078
- segments .append (_Segment (" " * pad_right , base_rich_style ))
1079
+ segments .append (
1080
+ _Segment (" " * pad_right , style .background_style .rich_style )
1081
+ )
1079
1082
strip = Strip (segments , content .cell_length + pad_left + pad_right )
1080
1083
return strip
1081
1084
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ def visualize(widget: Widget, obj: object) -> Visual:
88
88
89
89
if isinstance (obj , Text ) and widget .allow_select :
90
90
return Content .from_rich_text (
91
- obj , align = obj .align or widget .styles .text_align
91
+ obj , align = obj .justify or widget .styles .text_align
92
92
)
93
93
94
94
# If its is a Rich renderable, wrap it with a RichVisual
@@ -268,6 +268,11 @@ def without_color(self) -> Style:
268
268
_meta = self ._meta ,
269
269
)
270
270
271
+ @cached_property
272
+ def background_style (self ) -> Style :
273
+ """Just the background color, with no other attributes."""
274
+ return Style (self .background )
275
+
271
276
@classmethod
272
277
def combine (cls , styles : Iterable [Style ]) -> Style :
273
278
"""Add a number of styles and get the result."""
You can’t perform that action at this time.
0 commit comments