fix(ui): raise pad redraw threshold above buffer cap to fix history scroll
All checks were successful
CI Code / Check spelling (pull_request) Successful in 17s
CI Code / Check coding style (pull_request) Successful in 32s
CI Code / Linux (debian) (pull_request) Successful in 4m42s
CI Code / Linux (ubuntu) (pull_request) Successful in 4m50s
CI Code / Code Coverage (pull_request) Successful in 7m28s
CI Code / Linux (arch) (pull_request) Successful in 11m8s
All checks were successful
CI Code / Check spelling (pull_request) Successful in 17s
CI Code / Check coding style (pull_request) Successful in 32s
CI Code / Linux (debian) (pull_request) Successful in 4m42s
CI Code / Linux (ubuntu) (pull_request) Successful in 4m50s
CI Code / Code Coverage (pull_request) Successful in 7m28s
CI Code / Linux (arch) (pull_request) Successful in 11m8s
PAD_THRESHOLD (3000) sat below the buffer line cap (PAD_SIZE - PAD_SIZE/10 = 9000), so _win_ensure_pad_capacity() fired a full win_redraw() from the hot print path on every message once a chat exceeded 3000 rendered lines. During history paging this turned one redraw per fetch into dozens, corrupting per-entry y_start_pos (offset jumps, dropped/skipped messages) and causing ~10s lag per page. The flat-file backend was byte-identical across the regression; the fault was purely in the UI pad path from the upstream merge. Raise PAD_THRESHOLD to 12000 (above the cap) so the reclaim redraw only fires to drop dead pad space in long append-only sessions, never during scrolling. Also size the pad once to buffer->lines+100 in win_redraw() instead of shrinking to PAD_MIN_HEIGHT and regrowing per entry, removing the residual per-redraw wresize churn.
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 = 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, needed > PAD_MIN_HEIGHT ? needed : PAD_MIN_HEIGHT, cols);
|
||||
werase(window->layout->win);
|
||||
|
||||
for (unsigned int i = 0; i < size; i++) {
|
||||
|
||||
Reference in New Issue
Block a user