Set new length of the text, clipping or padding is required.
(self, new_length: int)
| 678 | self.right_crop(min(whitespace_count, excess)) |
| 679 | |
| 680 | def set_length(self, new_length: int) -> None: |
| 681 | """Set new length of the text, clipping or padding is required.""" |
| 682 | length = len(self) |
| 683 | if length != new_length: |
| 684 | if length < new_length: |
| 685 | self.pad_right(new_length - length) |
| 686 | else: |
| 687 | self.right_crop(length - new_length) |
| 688 | |
| 689 | def __rich_console__( |
| 690 | self, console: "Console", options: "ConsoleOptions" |