From: Christian Heller Date: Thu, 23 Oct 2025 03:42:31 +0000 (+0200) Subject: Fix log depth cutoff not limiting negative history scroll index. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/static/%7B%7Bdb.prefix%7D%7D/tasks?a=commitdiff_plain;h=7a53ad963d54293277bdbb784dcd85c4d4139b10;p=ircplom Fix log depth cutoff not limiting negative history scroll index. --- diff --git a/src/ircplom/tui_base.py b/src/ircplom/tui_base.py index ef48d08..9793164 100644 --- a/src/ircplom/tui_base.py +++ b/src/ircplom/tui_base.py @@ -174,6 +174,8 @@ class _HistoryWidget(_ScrollableWidget): if len(self._history) > self._maxlen_log: self._history = self._history[1:] self._history_offset += 1 + self._history_idx_neg = max(self._history_idx_neg, + -self._maxlen_log) wrap_offset = 0 for wrap_idx_pos, t in enumerate(self._wrapped): if t[0] == self._history_offset: diff --git a/src/tests/tui_draw.test b/src/tests/tui_draw.test index 814f15e..ad4d1e9 100644 --- a/src/tests/tui_draw.test +++ b/src/tests/tui_draw.test @@ -598,5 +598,13 @@ insert history_1 1:2 +20 insert scrolldown-29 : +21 insert status-0-[1]-prompt : +22 +# check cut-off log growth seen from topmost scroll not affecting scrolldown count, but unread-lines status +loggedservermsg 0 1 <.. PING :0 +log 1 >.. PONG :0 +insert lines-empty :20 +0 +insert history_1 3:4 +20 +insert scrolldown-29 : +21 +insert status-0-[1:2]-prompt : +22 + > /quit log 0 <..