Remove a number of characters from the end of the text.
(self, amount: int = 1)
| 1183 | return new_lines |
| 1184 | |
| 1185 | def right_crop(self, amount: int = 1) -> None: |
| 1186 | """Remove a number of characters from the end of the text.""" |
| 1187 | max_offset = len(self.plain) - amount |
| 1188 | _Span = Span |
| 1189 | self._spans[:] = [ |
| 1190 | ( |
| 1191 | span |
| 1192 | if span.end < max_offset |
| 1193 | else _Span(span.start, min(max_offset, span.end), span.style) |
| 1194 | ) |
| 1195 | for span in self._spans |
| 1196 | if span.start < max_offset |
| 1197 | ] |
| 1198 | self._text = [self.plain[:-amount]] |
| 1199 | self._length -= amount |
| 1200 | |
| 1201 | def wrap( |
| 1202 | self, |
no outgoing calls