Extend the Text given number of spaces where the spaces have the same style as the last character. Args: spaces (int): Number of spaces to add to the Text.
(self, spaces: int)
| 570 | return style |
| 571 | |
| 572 | def extend_style(self, spaces: int) -> None: |
| 573 | """Extend the Text given number of spaces where the spaces have the same style as the last character. |
| 574 | |
| 575 | Args: |
| 576 | spaces (int): Number of spaces to add to the Text. |
| 577 | """ |
| 578 | if spaces <= 0: |
| 579 | return |
| 580 | spans = self.spans |
| 581 | new_spaces = " " * spaces |
| 582 | if spans: |
| 583 | end_offset = len(self) |
| 584 | self._spans[:] = [ |
| 585 | span.extend(spaces) if span.end >= end_offset else span |
| 586 | for span in spans |
| 587 | ] |
| 588 | self._text.append(new_spaces) |
| 589 | self._length += spaces |
| 590 | else: |
| 591 | self.plain += new_spaces |
| 592 | |
| 593 | def highlight_regex( |
| 594 | self, |