From 33543d2543ee18f516ee7be1ebea6b380e552187 Mon Sep 17 00:00:00 2001 From: "jabber.developer2" Date: Tue, 14 Oct 2025 17:07:56 +0000 Subject: [PATCH] fix(ui,window): prevent buffer updates while viewing history to avoid scroll lock When the user scrolls back to view message history, suppress printing and buffer writes to keep the viewport stable and prevent the scroll position from jumping or getting stuck. Files: src/ui/window.c --- src/ui/window.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/ui/window.c b/src/ui/window.c index b2dba5a5..9bbe3094 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -1696,6 +1696,23 @@ win_newline(ProfWin* window) static void _win_printf(ProfWin* window, const char* show_char, int pad_indent, GDateTime* timestamp, int flags, theme_item_t theme_item, const char* const display_from, const char* const from_jid, const char* const message_id, const char* const message, ...) { + + /* Test code start + Description: this code prevents printing and buffer update when user is viewing message history [SCROLLING] + + TODO: + - check window->layout->paged handling for reliability (if buffer size is less than window size [SCROLLING] not set) + - make a propper condition check for differernt cases + - add a user notification in header when new messages arrive while scrolling history + - handle SCROLLED state properly in case of incominf messages (currently it is cleared before new message is printed) + +#warning "TEST CODE: temporary/test code present in window.c:1709 - remove before release"*/ + + if ((window->layout->paged) && wins_is_current(window)) { + return; + } + /* Test code end */ + if (timestamp == NULL) { timestamp = g_date_time_new_now_local(); } else {