Rewinds the terminal cursor to the beginning and writes the given line. :param erase: If True, will also add spaces until the full terminal width to ensure previous lines are properly erased. The rest of the keyword arguments are markup instructions.
(self, line: str, **markup: bool)
| 538 | self._tw.line(line, **markup) |
| 539 | |
| 540 | def rewrite(self, line: str, **markup: bool) -> None: |
| 541 | """Rewinds the terminal cursor to the beginning and writes the given line. |
| 542 | |
| 543 | :param erase: |
| 544 | If True, will also add spaces until the full terminal width to ensure |
| 545 | previous lines are properly erased. |
| 546 | |
| 547 | The rest of the keyword arguments are markup instructions. |
| 548 | """ |
| 549 | erase = markup.pop("erase", False) |
| 550 | if erase: |
| 551 | fill_count = self._tw.fullwidth - len(line) - 1 |
| 552 | fill = " " * fill_count |
| 553 | else: |
| 554 | fill = "" |
| 555 | line = str(line) |
| 556 | self._tw.write("\r" + line + fill, **markup) |
| 557 | |
| 558 | def write_sep( |
| 559 | self, |