From: Christian Heller Date: Wed, 8 Oct 2025 18:09:25 +0000 (+0200) Subject: Handle history cutoff drawing edge cases. X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/%7B%7Bdb.prefix%7D%7D/conditions?a=commitdiff_plain;ds=sidebyside;p=ircplom Handle history cutoff drawing edge cases. --- diff --git a/src/ircplom/tui_base.py b/src/ircplom/tui_base.py index c82eddf..12cfe98 100644 --- a/src/ircplom/tui_base.py +++ b/src/ircplom/tui_base.py @@ -154,7 +154,8 @@ class _HistoryWidget(_ScrollableWidget): -1 if (not self._wrapped) else (-len(self._wrapped) + self._last_wrapped_idx_pos_for_hist_idx_pos( - self._len_full_history + self._history_idx_neg))) + self._len_full_history + max(self._history_idx_neg, + -_LOG_MAX_LEN)))) self.bookmark() def append(self, to_append: str) -> None: @@ -219,6 +220,8 @@ class _HistoryWidget(_ScrollableWidget): del self._wrapped[bookmark_idx_neg] if bookmark_idx_neg > self._wrapped_idx_neg: self._wrapped_idx_neg += 1 + if self._newest_read_history_idx_pos < self._history_offset: + return bookmark_wrapped_idx_pos = ( 0 if (not self._wrapped) else (1 + self._last_wrapped_idx_pos_for_hist_idx_pos(