From ea1e18cb24038d46b6501cfec3f0afbe06004343 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sat, 29 Nov 2025 22:25:57 +0100 Subject: [PATCH] Fix crashes on SIGWINCH. --- src/ircplom/tui_base.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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: -- 2.30.2