From: Christian Heller Date: Mon, 11 Aug 2025 00:47:20 +0000 (+0200) Subject: Remove some redundant drawing code. X-Git-Url: https://plomlompom.com/repos/booking/static/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/edit?a=commitdiff_plain;h=8ee18ac162b3512087a2ca7d2b6d0f7e22c38db2;p=ircplom Remove some redundant drawing code. --- diff --git a/ircplom/tui_base.py b/ircplom/tui_base.py index 3c2d46a..c829bbf 100644 --- a/ircplom/tui_base.py +++ b/ircplom/tui_base.py @@ -328,7 +328,6 @@ class Window(_Widget): return f'{self.idx}) {self._title}' def draw(self) -> bool: - self._term.clear() if not super().draw(): if self._term.size.x > 0: lines = [''] @@ -341,8 +340,8 @@ class Window(_Widget): return False title_box = f'{self.status_title}]' status_line = title_box + '=' * (self._term.size.x - len(title_box)) - self.history.draw() self._term.write(status_line, self._y_status) + self.history.draw() self.prompt.draw() return True @@ -418,7 +417,7 @@ class BaseTui(QueueMixin): def _switch_window(self, idx: int) -> None: self._window_idx = idx - self.window.draw() + self.window.tainted = True @property def _commands(self) -> dict[str, tuple[Callable[..., None | Optional[str]], @@ -563,7 +562,7 @@ class Terminal(QueueMixin): @contextmanager def setup(self) -> Generator: 'Combine multiple contexts into one and run keypress loop.' - self.clear() + print(self._blessed.clear, end='') with (self._blessed.raw(), self._blessed.fullscreen(), self._blessed.hidden_cursor(), @@ -583,10 +582,6 @@ class Terminal(QueueMixin): '(Re-)calculate .size..' self.size = _YX(self._blessed.height, self._blessed.width) - def clear(self) -> None: - 'Clear terminal.' - print(self._blessed.clear, end='') - def flush(self) -> None: 'Flush terminal.' print('', end='', flush=True)