Method: rich.text.Text._trim_spans
Calls: 100, Exceptions: 0, Paths: 1Back
Path 1: 100 calls (1.0)
1def _trim_spans(self) -> None:
2 """Remove or modify any spans that are over the end of the text."""
3 max_offset = len(self.plain)
4 _Span = Span
5 self._spans[:] = [
6 (
7 span
8 if span.end < max_offset
9 else _Span(span.start, min(max_offset, span.end), span.style)
10 )
11 for span in self._spans
12 if span.start < max_offset
13 ]