From: Christian Heller Date: Sun, 10 Aug 2025 12:02:29 +0000 (+0200) Subject: Depend tainting in _WindowClientManager.update re prompts on actual changes having... X-Git-Url: https://plomlompom.com/repos/booking/%7B%7B%20web_path%20%7D%7D/static/templates?a=commitdiff_plain;h=67e83ee41913df149be7d85d1552e04d4e63f0ea;p=ircplom Depend tainting in _WindowClientManager.update re prompts on actual changes having happened. --- diff --git a/ircplom/client_tui.py b/ircplom/client_tui.py index 3916fb4..1b55f87 100644 --- a/ircplom/client_tui.py +++ b/ircplom/client_tui.py @@ -96,17 +96,16 @@ class _ClientWindowsManager: for stream in (STREAM_SERVER, STREAM_RAW): self._new_window(stream) - def _if_privmsg_update_prefix(self, win: _ClientWindow) -> None: - if isinstance(win, _PrivmsgWindow): - win.prompt.update_prefix( - **{k: getattr(self, k) - for k in _PrivmsgPromptWidget.prefix_update_keys()}) + def _prompt_update(self, win: _PrivmsgWindow) -> None: + to_set = win.prompt.prefix_update_keys() + win.prompt.update_prefix(**{k: getattr(self, k) for k in to_set}) def _new_window(self, stream: str) -> _ClientWindow: win_class = (_PrivmsgWindow if stream[0:1] != STREAM_PREFIX_META else _ClientWindow) win = self._tui_new_window(win_class, stream=stream) - self._if_privmsg_update_prefix(win) + if isinstance(win, _PrivmsgWindow): + self._prompt_update(win) self.windows += [win] return win @@ -130,8 +129,10 @@ class _ClientWindowsManager: setattr(self, k, v) tainteds = False if _PrivmsgPromptWidget.prefix_update_keys() & set(kwargs.keys()): - for win in self.windows: - self._if_privmsg_update_prefix(win) + for win in [w for w in self.windows + if isinstance(w, _PrivmsgWindow)]: + self._prompt_update(win) + tainteds |= win.prompt.tainted tainteds = True return tainteds