From ca92d29179bcc060361f64e937572b6c8bd0edfe Mon Sep 17 00:00:00 2001 From: Jabber Developer Date: Wed, 24 Jun 2026 16:22:52 +0000 Subject: [PATCH] fix(ui): measure dead pad space from cursor instead of absolute height Remove the /autoping warning subcommand and PREF_AUTOPING_WARNING preference entirely. The warning was shown at connect time when autoping was disabled but the server supported XEP-0199 ping. The pad threshold logic previously used an absolute height (PAD_THRESHOLD=12000) which was above the buffer cap and never fired during normal scrolling. Replace with a dead-space measurement (cursor position minus live buffer lines) that only triggers a redraw when dead space exceeds PAD_DEAD_SPACE_LIMIT (2000 lines). Author: jabber.developer2 --- src/ui/window.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ui/window.c b/src/ui/window.c index 0f6e2780..4cbbbb71 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -43,7 +43,7 @@ #include "ai/ai_client.h" static const int PAD_MIN_HEIGHT = 100; -static const int PAD_THRESHOLD = 12000; // above buffer cap (~9000): reclaims dead pad space, never fires while scrolling +static const int PAD_DEAD_SPACE_LIMIT = 2000; // reclaim once the pad holds this much dead space (cursor past live buffer); size-independent, so it never fires while scrolling static gboolean _in_redraw = FALSE; static void @@ -56,9 +56,10 @@ _win_ensure_pad_capacity(ProfWin* window, WINDOW* win, int lines_needed) int cur_height = getmaxy(win); int cur_width = getmaxx(win); if (lines_needed >= cur_height - 1) { - // If we are getting too large, trigger a redraw to clean up old lines - // but only if we are not already in a redraw process. - if (window && cur_height >= PAD_THRESHOLD && !_in_redraw) { + // redraw to reclaim dead pad space (cursor far past live buffer, e.g. a long + // append-only session); dead space never accrues while scrolling, only here + int dead = window ? getcury(win) - window->layout->buffer->lines : 0; + if (window && dead > PAD_DEAD_SPACE_LIMIT && !_in_redraw) { win_redraw(window); } else { // resize to required lines + some buffer for next messages