Skip to content

Commit e84eaf5

Browse files
committed
tidy
1 parent ff0211f commit e84eaf5

File tree

4 files changed

+19
-25
lines changed

4 files changed

+19
-25
lines changed

src/textual/_compositor.py

+2-19
Original file line numberDiff line numberDiff line change
@@ -930,21 +930,6 @@ def get_widget_and_offset_at(
930930

931931
return widget, (None if offset_y is None else Offset(offset_x2, offset_y))
932932

933-
# for segment in lines[0]:
934-
# end += segment.cell_length
935-
# if x <= end:
936-
# style = segment.style
937-
# if style and style._meta is not None:
938-
# meta = style.meta
939-
# if "offset" in meta:
940-
# offset_x, offset_y = style.meta["offset"]
941-
# offset = Offset(offset_x + (x - start), offset_y)
942-
# return widget, offset
943-
944-
# return widget, None
945-
# start = end
946-
return widget, None
947-
948933
def find_widget(self, widget: Widget) -> MapGeometry:
949934
"""Get information regarding the relative position of a widget in the Compositor.
950935
@@ -1129,11 +1114,9 @@ def render_full_update(self, simplify: bool = False) -> LayoutUpdate:
11291114
crop = screen_region
11301115
chops = self._render_chops(crop, lambda y: True)
11311116
if simplify:
1132-
render_strips = [
1133-
Strip.join(chop.values()).discard_meta().simplify() for chop in chops
1134-
]
1117+
render_strips = [Strip.join(chop.values()).simplify() for chop in chops]
11351118
else:
1136-
render_strips = [Strip.join(chop.values()).discard_meta() for chop in chops]
1119+
render_strips = [Strip.join(chop.values()) for chop in chops]
11371120

11381121
return LayoutUpdate(render_strips, screen_region)
11391122

src/textual/content.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1023,8 +1023,9 @@ def to_strip(self, style: Style) -> Strip:
10231023
content = content.stylize(self.highlight_style, start, end)
10241024

10251025
if align in ("start", "left") or (align == "justify" and self.line_end):
1026+
pass
10261027
pad_right = width - self.content.cell_length
1027-
pad_right = 0
1028+
# pad_right = 0
10281029

10291030
elif align == "center":
10301031
excess_space = width - self.content.cell_length

src/textual/strip.py

+14-4
Original file line numberDiff line numberDiff line change
@@ -402,15 +402,25 @@ def discard_meta(self) -> Strip:
402402
"""
403403

404404
def remove_meta_from_segment(segment: Segment) -> Segment:
405-
if segment.style is None:
406-
return segment
405+
"""Build a Segment with no meta.
406+
407+
Args:
408+
segment: Segment.
409+
410+
Returns:
411+
Segment, sans meta.
412+
"""
407413
text, style, control = segment
414+
if style is None:
415+
return segment
408416
style = style.copy()
409417
style._meta = None
410-
411418
return Segment(text, style, control)
412419

413-
return Strip([segment for segment in self._segments], self._cell_length)
420+
return Strip(
421+
[remove_meta_from_segment(segment) for segment in self._segments],
422+
self._cell_length,
423+
)
414424

415425
def apply_filter(self, filter: LineFilter, background: Color) -> Strip:
416426
"""Apply a filter to all segments in the strip.

src/textual/visual.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def without_color(self) -> Style:
272272
@cached_property
273273
def background_style(self) -> Style:
274274
"""Just the background color, with no other attributes."""
275-
return Style(self.background)
275+
return Style(self.background, _meta=self._meta)
276276

277277
@classmethod
278278
def combine(cls, styles: Iterable[Style]) -> Style:

0 commit comments

Comments
 (0)