home · contact · privacy
Fix crashes on SIGWINCH.
authorChristian Heller <c.heller@plomlompom.de>
Sat, 29 Nov 2025 21:25:57 +0000 (22:25 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sat, 29 Nov 2025 21:25:57 +0000 (22:25 +0100)
src/ircplom/tui_base.py

index 46370175e3a5f5fe0aa89ef6ee0ee65bf5a3ff2c..5def0f2c4daace899d4c75781d38942df41f228d 100644 (file)
@@ -318,6 +318,7 @@ class _HistoryWidget(_ScrollableWidget):
 
     def set_geometry(self, size: _YX) -> None:
         super().set_geometry(size)
+        self._unbookmark()
         if self._drawable:
             self._y_pgscroll = self._size.y // 2
             self._wrapped.clear()
@@ -385,14 +386,17 @@ class _HistoryWidget(_ScrollableWidget):
             = max(self._lowest_read_history_idx_pos,
                   visible_lines[-1].history_idx_pos)
 
-    def bookmark(self) -> None:
-        'Store next idx to what most recent line we have (been) scrolled.'
+    def _unbookmark(self) -> None:
         if self._bookmark_idx_neg != self._UNSET_IDX_NEG\
                 and len(self._wrapped) > -self._bookmark_idx_neg:
             del self._wrapped[self._bookmark_idx_neg]
             if self._bookmark_idx_neg > self._wrapped_idx_neg:
                 self._wrapped_idx_neg += 1
         self._bookmark_idx_neg = self._UNSET_IDX_NEG
+
+    def bookmark(self) -> None:
+        'Store next idx to what most recent line we have (been) scrolled.'
+        self._unbookmark()
         if self._lowest_read_history_idx_pos < self._history_n_lines_cut:
             return
         if not self._wrapped: