From: Christian Heller Date: Sat, 29 Nov 2025 21:25:57 +0000 (+0100) Subject: Fix crashes on SIGWINCH. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/process_titles?a=commitdiff_plain;h=ea1e18cb24038d46b6501cfec3f0afbe06004343;p=ircplom Fix crashes on SIGWINCH. --- diff --git a/src/ircplom/tui_base.py b/src/ircplom/tui_base.py index 4637017..5def0f2 100644 --- a/src/ircplom/tui_base.py +++ b/src/ircplom/tui_base.py @@ -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: