From 84a79e18a79831d7c08227b2956e9d9b0776df4d Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Wed, 8 Oct 2025 20:09:25 +0200 Subject: [PATCH] Handle history cutoff drawing edge cases. --- src/ircplom/tui_base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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( -- 2.30.2