Fix scroll/paging state and buffer handling #45

Manually merged
jabber.developer merged 6 commits from playground/fix/scroll-stuck into master 2026-01-07 10:56:04 +00:00
Collaborator

Summary:

Fix for Scroll stuck on sending/receiving messages while scrolling the history according to issue #36

Changes:

Fixes several issues around UI buffer handling during scrolling/paging and unread message indicators.
Improves paging/unread tracking logic in the window UI to prevent missed unread indicators while scrolling.

Known issues:

Current implementation requires extra Page Down to quit from Scrolling state Issue #44

Testing

  • Manually (by reproducing issue steps)

Resolves #44

### Summary: Fix for Scroll stuck on sending/receiving messages while scrolling the history according to issue #36 ### Changes: Fixes several issues around UI buffer handling during scrolling/paging and unread message indicators. Improves paging/unread tracking logic in the window UI to prevent missed unread indicators while scrolling. ### Known issues: Current implementation requires extra Page Down to quit from Scrolling state Issue #44 ### Testing - [x] Manually (by reproducing issue steps) Resolves #44
jabber.developer2 added 4 commits 2025-10-28 06:00:58 +00:00
Temporary test code, that prevents printing and buffer update when user is viewing message history
Updated paged state handling to ensure accurate tracking of unread messages.

Issues: extra page down needed to clear paged state when at bottom of window with unread messages.
Buffer size reverted from debug value to current standard. Comments updated.
Some checks failed
CI Code / Check coding style (pull_request) Failing after 11m14s
CI Code / Linux (arch) (pull_request) Successful in 12m44s
CI Code / Check spelling (pull_request) Failing after 14m20s
CI Code / Linux (debian) (pull_request) Successful in 15m35s
CI Code / Linux (ubuntu) (pull_request) Successful in 1h20m31s
130bb7d1a0
jabber.developer2 force-pushed playground/fix/scroll-stuck from 130bb7d1a0 to fbe73a07f3 2025-10-28 06:01:19 +00:00 Compare
jabber.developer requested changes 2025-10-28 16:49:37 +00:00
Dismissed
jabber.developer left a comment
Owner

Generally LGTM, but please fix formatting for CI.

Generally LGTM, but please fix formatting for CI.
src/ui/buffer.c Outdated
@@ -99,6 +99,7 @@ _buffer_add(ProfBuff buffer, const char* show_char, int pad_indent, GDateTime* t
// With 10% margin to ensure overflow prevention
while (buffer->lines >= PAD_SIZE - (PAD_SIZE / 10) && g_slist_length(buffer->entries) > 1) {
log_debug("DELETING");

If we keep this debug message in the prod, then maybe we can make it slightly more informative?

If we keep this debug message in the prod, then maybe we can make it slightly more informative?
jabber.developer marked this conversation as resolved
src/ui/window.c Outdated
@@ -710,3 +713,3 @@
// Scrolled down after reaching the bottom of the page
if ((*page_start > total_rows - page_space || (*page_start == page_space && *page_start >= total_rows)) && window->type == WIN_CHAT) {
if (((*page_start > total_rows + window->layout->unread_msg - page_space) || ((*page_start == page_space + window->layout->unread_msg) && *page_start >= (total_rows + window->layout->unread_msg))) && window->type == WIN_CHAT) {

At this point, it's really hard to track what this condition is doing. I suggest that we split it into variables with descriptive names so we can understand what's going on in the future

At this point, it's really hard to track what this condition is doing. I suggest that we split it into variables with descriptive names so we can understand what's going on in the future
jabber.developer marked this conversation as resolved
src/ui/window.c Outdated
@@ -744,3 +747,3 @@
// update only if position has changed
if (page_start_initial != *page_start) {
if ((page_start_initial != *page_start) || (window->layout->unread_msg)) {

nit: I think that we can get rid of extra pair of parentheses.

nit: I think that we can get rid of extra pair of parentheses.
jabber.developer marked this conversation as resolved
src/ui/window.c Outdated
@@ -749,3 +752,2 @@
// switch off page if last line and space line visible
if (total_rows - *page_start == page_space) {
/*switch off page if no messages left to read

Could you apply our standard formatting (should apply automatically on ctrl+shift+i in VSCode)? It will fix the CI

Could you apply our standard formatting (should apply automatically on `ctrl+shift+i` in VSCode)? It will fix the CI
jabber.developer marked this conversation as resolved
src/ui/window.c Outdated
@@ -1698,1 +1705,4 @@
{
/* Prevent printing and buffer update when user is viewing message history [SCROLLING]*/
if ((window->layout->paged) && wins_is_current(window)) {

Nice place for condition and logic.

I feel that readability could be slightly improved without extra pair of parentheses in (window->layout->paged).

Nice place for condition and logic. I feel that readability could be slightly improved without extra pair of parentheses in `(window->layout->paged)`.
jabber.developer marked this conversation as resolved
jabber.developer2 added 1 commit 2025-10-28 16:51:55 +00:00
Comments update for gitlab metrics fix
All checks were successful
CI Code / Check spelling (pull_request) Successful in 20s
CI Code / Check coding style (pull_request) Successful in 35s
CI Code / Linux (ubuntu) (pull_request) Successful in 15m2s
CI Code / Linux (debian) (pull_request) Successful in 17m3s
CI Code / Linux (arch) (pull_request) Successful in 9m50s
a4efa61fc9
jabber.developer2 added 1 commit 2025-10-29 14:46:59 +00:00
Source refactoing after code review;
All checks were successful
CI Code / Check spelling (pull_request) Successful in 20s
CI Code / Check coding style (pull_request) Successful in 35s
CI Code / Linux (arch) (pull_request) Successful in 10m15s
CI Code / Linux (debian) (pull_request) Successful in 13m31s
CI Code / Linux (ubuntu) (pull_request) Successful in 13m51s
68e214f27f
jabber.developer2 added 1 commit 2025-10-29 15:32:10 +00:00
Source refactoing after code review;
Some checks failed
CI Code / Check spelling (pull_request) Successful in 20s
CI Code / Check coding style (pull_request) Failing after 36s
CI Code / Linux (ubuntu) (pull_request) Successful in 15m49s
CI Code / Linux (debian) (pull_request) Successful in 18m22s
CI Code / Linux (arch) (pull_request) Failing after 42s
a0e3f80efa
jabber.developer2 was assigned by jabber.developer 2025-10-29 16:52:49 +00:00
jabber.developer added the
Kind/Bug
label 2025-10-29 16:53:06 +00:00
jabber.developer requested review from jabber.developer 2025-10-29 16:53:20 +00:00
jabber.developer approved these changes 2025-10-29 16:53:47 +00:00
Dismissed
jabber.developer left a comment
Owner

LGTM! Just fix formatting for CI.

LGTM! Just fix formatting for CI.
jabber.developer2 added 1 commit 2025-10-29 17:16:53 +00:00
Comments and formatting updates
Some checks failed
CI Code / Check spelling (pull_request) Successful in 53s
CI Code / Check coding style (pull_request) Successful in 1m6s
CI Code / Linux (arch) (pull_request) Failing after 18s
CI Code / Linux (debian) (pull_request) Has been cancelled
CI Code / Linux (ubuntu) (pull_request) Has been cancelled
8f9cc05113

Could you rebase on master so we can see correct CI build?

Could you rebase on master so we can see correct CI build?
jabber.developer2 force-pushed playground/fix/scroll-stuck from 8f9cc05113 to 395d77b38a 2025-11-04 04:24:21 +00:00 Compare
jabber.developer2 force-pushed playground/fix/scroll-stuck from 395d77b38a to 522db05090 2025-11-04 05:28:28 +00:00 Compare
jabber.developer approved these changes 2025-11-28 11:41:00 +00:00
jabber.developer manually merged commit f446f48d07 into master 2026-01-07 10:56:04 +00:00
Sign in to join this conversation.
No description provided.