Method: rich.text.Text.right_crop
Calls: 24, Exceptions: 0, Paths: 1Back
Path 1: 24 calls (1.0)
1 (18) 3 (2) 2 (2) 8 (1) 4 (1)
1def right_crop(self, amount: int = 1) -> None:
2 """Remove a number of characters from the end of the text."""
3 max_offset = len(self.plain) - amount
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 ]
14 self._text = [self.plain[:-amount]]
15 self._length -= amount