home · contact · privacy
Simplify ._focused_set_and_report_change branchings.
authorChristian Heller <c.heller@plomlompom.de>
Thu, 11 Sep 2025 14:52:40 +0000 (16:52 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Thu, 11 Sep 2025 14:52:40 +0000 (16:52 +0200)
ircplom/client_tui.py

index 52853f555589de7bc1ff7418afda8105c7d2cb82..ba1b29578bd0dac7bc87e1f65dbf386b4fe12733 100644 (file)
@@ -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':