From 23c83bf72a726ef15eb1a733d1548af7c3005a27 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Thu, 11 Sep 2025 16:52:40 +0200 Subject: [PATCH] Simplify ._focused_set_and_report_change branchings. --- ircplom/client_tui.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ircplom/client_tui.py b/ircplom/client_tui.py index 52853f5..ba1b295 100644 --- a/ircplom/client_tui.py +++ b/ircplom/client_tui.py @@ -67,14 +67,14 @@ class _UpdatingNode(AutoAttrMixin): ) -> Optional[tuple[LogScope, Any]]: scope = self._scope(update.key) if update.value is None: - if not self._is_set(update.key): - return None - self._unset(update.key) - return (scope, None) + if self._is_set(update.key): + self._unset(update.key) + return scope, None + return None if old_value == update.value: return None self._set(update.key, update.value) - return (scope, update.value) + return scope, update.value def _get(self, key: str): return getattr(self, key) @@ -241,9 +241,10 @@ class _UpdatingUser(_UpdatingNode, NickUserHost): self, old_value: '_UpdatingNode', update: _Update ) -> Optional[tuple[LogScope, Any]]: assert isinstance(update.value, str) - if update.key == 'modes': - return super()._focused_set_and_report_change(old_value, update) - if super()._focused_set_and_report_change(old_value, update): + if (result := super()._focused_set_and_report_change(old_value, + update)): + if update.key not in {'nick', 'exit_msg'}: + return result scope = self._scope(update.key) msg = 'RAW:' if update.key == 'nick': -- 2.30.2