fix(ui): raise pad redraw threshold above buffer cap to fix history scroll #133

Manually merged
jabber.developer2 merged 1 commits from fix/history-scroll-pad-redraw-storm into master 2026-06-08 13:05:10 +00:00

View File

@@ -43,7 +43,7 @@
#include "ai/ai_client.h"
static const int PAD_MIN_HEIGHT = 100;
static const int PAD_THRESHOLD = 3000;
static const int PAD_THRESHOLD = 12000; // above buffer cap (~9000): reclaims dead pad space, never fires while scrolling
static gboolean _in_redraw = FALSE;
static void
@@ -2172,9 +2172,10 @@ win_redraw(ProfWin* window)
unsigned int size = buffer_size(window->layout->buffer);
_in_redraw = TRUE;
// shrink pad back to minimum size and erase it
// size the pad to fit the whole buffer (plus headroom) and erase it
int cols = getmaxx(window->layout->win);
wresize(window->layout->win, PAD_MIN_HEIGHT, cols);
int needed = window->layout->buffer->lines + 100;
wresize(window->layout->win, MAX(needed, PAD_MIN_HEIGHT), cols);
jabber.developer marked this conversation as resolved Outdated

why not use MAX macro from GLib?

why not use `MAX` macro from GLib?
werase(window->layout->win);
for (unsigned int i = 0; i < size; i++) {