def refresh(self, repaint: bool = True, layout: bool = False) -> None: sync_available = os.environ.get("TERM_PROGRAM", "") != "Apple_Terminal" if not self._closed: console = self.console try: if sync_available: console.file.write("\x1bP=1s\x1b\\") console.print(Screen(Control.home(), self.view, Control.home())) if sync_available: console.file.write("\x1bP=2s\x1b\\") console.file.flush() except Exception: self.panic()
def __rich_console__(self, console: Console, options: ConsoleOptions) -> RenderResult: yield Control.home().segment x = self.region.x new_line = Segment.line() move_to = Control.move_to for last, (y, line) in loop_last(enumerate(self.lines, self.region.y)): yield move_to(x, y).segment yield from line if not last: yield new_line