mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-17 23:26:20 +00:00
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 <jabber.developer2@jabber.space>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user