From 6a394ae2e5feae199b6128b4496417d3e770bf65 Mon Sep 17 00:00:00 2001 From: Jabber Developer Date: Tue, 1 Jul 2025 16:42:03 +0200 Subject: [PATCH] fix: Increase scrollback buffer height for chat rendering (PAD_SIZE) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit f27fa98 commit introduced issue of scrolling seemingly randomly being stuck and the following message flood in the logs: "WRN: Ncurses Overflow..." A pad is an off-screen buffer — larger than the visible terminal screen — that you can scroll, render parts of, or update selectively. Unlike regular windows, a pad is not tied to screen size. You can create a pad that's 1,000 lines tall, even if your terminal is only 40 lines tall. This commit addresses the issue by increasing PAD_SIZE to a reasonable number, allowing messages from buffer to be displayed without overflowing NCurses' window size (maxy). Minor change: add .cache folder to gitignore --- .gitignore | 3 +++ src/ui/window.c | 1 - src/ui/window.h | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 37a7838b..6e24b69c 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,9 @@ src/gitversion.h.in src/stamp-h1 src/plugins/profapi.lo +# clangd +.cache/ + # out-of-tree build folders build*/ diff --git a/src/ui/window.c b/src/ui/window.c index 88271b34..be53eae9 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -62,7 +62,6 @@ #include "xmpp/xmpp.h" #include "xmpp/roster_list.h" -static const int PAD_SIZE = 100; static const char* LOADING_MESSAGE = "Loading older messages…"; static const char* CONS_WIN_TITLE = "Profanity. Type /help for help information."; static const char* XML_WIN_TITLE = "XML Console"; diff --git a/src/ui/window.h b/src/ui/window.h index 7749cb0d..2c4da707 100644 --- a/src/ui/window.h +++ b/src/ui/window.h @@ -56,6 +56,9 @@ #include "xmpp/contact.h" #include "xmpp/muc.h" +// Max lines per window rendered by NCurses +static const int PAD_SIZE = 10000; + void win_move_to_end(ProfWin* window); void win_show_status_string(ProfWin* window, const char* const from, const char* const show, const char* const status,