home · contact · privacy
Handle history cutoff drawing edge cases. master
authorChristian Heller <c.heller@plomlompom.de>
Wed, 8 Oct 2025 18:09:25 +0000 (20:09 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 8 Oct 2025 18:09:25 +0000 (20:09 +0200)
src/ircplom/tui_base.py

index c82eddf34d132065f397680248029a1862a2ff55..12cfe9853254a7d994d061abffa4a785ee226eb5 100644 (file)
@@ -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(